Guest User

Untitled

a guest
Dec 17th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. using UnityEditor;
  2. using UnityEngine;
  3.  
  4. namespace Varguiniano
  5. {
  6. /// <inheritdoc />
  7. /// <summary>
  8. /// Class with some utilities for editors.
  9. /// </summary>
  10. public class ExtendedEditor<T> : Editor where T : MonoBehaviour
  11. {
  12. /// <summary>
  13. /// Reference to the object being edited.
  14. /// </summary>
  15. protected T TargetObject => (T) target;
  16.  
  17. /// <summary>
  18. /// Paints the property given.
  19. /// </summary>
  20. /// <param name="name">Name of that property.</param>
  21. /// <param name="includeChildren">Should it include children?</param>
  22. protected void PaintProperty(string name, bool includeChildren = false)
  23. {
  24. var property = serializedObject.FindProperty(name);
  25. EditorGUILayout.PropertyField(property, includeChildren);
  26. }
  27. }
  28. }
Add Comment
Please, Sign In to add comment