Last active
February 14, 2022 02:26
-
-
Save kraj0t/48d062ef996f953adae899855858e58d to your computer and use it in GitHub Desktop.
Unity Editor: undocumented callbacks in Editor class to define bounds for focus
This file contains hidden or 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
/// <summary> | |
/// Undocumented Unity callback. More info here: | |
/// https://forum.unity.com/threads/editor-how-do-i-set-the-bounds-of-an-empty-gameobject-for-focus-f-key.427093/ | |
/// </summary> | |
/// <returns></returns> | |
public bool HasFrameBounds() | |
{ | |
return true; | |
} | |
/// <summary> | |
/// Undocumented Unity callback. More info here: | |
/// https://forum.unity.com/threads/editor-how-do-i-set-the-bounds-of-an-empty-gameobject-for-focus-f-key.427093/ | |
/// </summary> | |
/// <returns></returns> | |
public Bounds OnGetFrameBounds() | |
{ | |
var line = target as UILineRendererSimplified; | |
var bounds = new Bounds(); | |
foreach (var p in line.Points) | |
{ | |
bounds.Encapsulate(p); | |
} | |
bounds.center = line.transform.position; | |
return bounds; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment