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>Universal method for retrieving the fileId of a component inside a saved gameObject, and the guid to the file that contains the gameObject. | |
| /// The gameObject could live in a prefab or in a scene, and the component does not need to be at the root gameObject of the prefab.</summary> | |
| /// <param name="comp"></param> | |
| /// <returns>A tuple containing the guid and the fileId of the component. Returns null if the component's gameObject has not been saved to a scene or a prefab.</returns> | |
| public static Tuple<string, long> GetComponentIdentifiers(Component comp) | |
| { | |
| // Check if the component is the direct instance from the prefab. | |
| // In the Editor, this means that the prefab asset is selected and the component is showing in the Inspector. | |
| if (AssetDatabase.TryGetGUIDAndLocalFileIdentifier(comp, out string guid, out long fileId)) | |
| { |
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
| using UnityEditor; | |
| using UnityEditor.UI; | |
| using UnityEngine; | |
| using UnityEngine.UI; | |
| [CustomEditor(typeof(Image))] | |
| public class CustomImageEditor : ImageEditor | |
| { | |
| public override void OnInspectorGUI() | |
| { |
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
| using System.Reflection; | |
| using UnityEditor; | |
| using UnityEngine; | |
| [CustomEditor(typeof(ParticleSystem))] | |
| public class CustomParticleSystemEditor : Editor | |
| { | |
| private Editor _builtInEditor; | |
| private void OnEnable() |
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
| using UnityEngine; | |
| using UnityEditor; | |
| using UnityEditor.EditorTools; | |
| [EditorTool("Orbit Parent Tool", typeof(Transform))] | |
| class OrbitParentTool : EditorTool | |
| { | |
| [SerializeField] | |
| private Texture2D _toolIcon; |
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
| using System; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public struct GUIBackgroundColorScope : IDisposable | |
| { | |
| private static readonly Stack<Color> _colorStack = new Stack<Color>(); | |
| public GUIBackgroundColorScope(Color color) | |
| { |
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; | |
| } |
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
| // Somewhere in your OnSceneGUI() ... | |
| // Draw dotted lines. | |
| var handlesColorBkp = Handles.color; | |
| Handles.color = new Color(0f, 0f, 0.5f); | |
| for (int i = 0; i < points.Length - 1; i++) | |
| { | |
| Handles.DrawDottedLine(points[i], points[i + 1], DOTTED_LINE_SIZE); | |
| } |
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
| /* | |
| * @brief Editor menu item and shortcut for capturing the game view into the system clipboard. | |
| * | |
| * @setup The System.Drawing and System.Windows.Forms Mono DLLs need to be referenced. See the documentation for | |
| * CopyTextureToClipboard below. | |
| * | |
| * @usage Access from the menu item or use the shortcut. Both are defined below as attribute of GameViewToClipboard(), | |
| * defaults to Shift+S | |
| * | |
| * @author Aurelio Provedo |