Skip to content

Instantly share code, notes, and snippets.

@PopupAsylum
Created January 24, 2017 11:41
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PopupAsylum/dfb33822430523642b6a7856702c08e4 to your computer and use it in GitHub Desktop.
Save PopupAsylum/dfb33822430523642b6a7856702c08e4 to your computer and use it in GitHub Desktop.
Change how unity's 'F' framing is applied
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class CustomFramer : MonoBehaviour {
public float radius = 1f;
private void OnDrawGizmosSelected() {
Gizmos.DrawWireSphere(transform.position, radius);
}
}
#if UNITY_EDITOR
[CustomEditor(typeof(CustomFramer))]
public class CustomFramerEditor : Editor {
private bool HasFrameBounds() {
return true;
}
private Bounds OnGetFrameBounds() {
CustomFramer framer = target as CustomFramer;
return new Bounds(framer.transform.position, Vector3.one * framer.radius * 2f);
}
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment