Created
January 24, 2017 11:41
-
-
Save PopupAsylum/dfb33822430523642b6a7856702c08e4 to your computer and use it in GitHub Desktop.
Change how unity's 'F' framing is applied
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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