Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Customizing playable director editor in Inspector window.

Discussion in 'Timeline' started by jin-archipin, May 4, 2020.

  1. jin-archipin

    jin-archipin

    Joined:
    Dec 17, 2019
    Posts:
    35
    I was trying to add button in playable director, and found out this code below is ruining original layout of playable director.

    Code (CSharp):
    1.  
    2. [CustomEditor(typeof(PlayableDirector))]
    3. public class FooEditor : Editor
    4. {
    5.     public override void OnInspectorGUI()
    6.     {
    7.         base.OnInspectorGUI();
    8.        
    9.         GUILayout.Button("testButton");
    10.     }
    11. }
    and it looks like below...

    upload_2020-5-4_12-49-33.png

    I think I need to inherit original editor for playable director, but I can't find it. Does anyone know about this?

    Thank you in advance.
     
  2. jin-archipin

    jin-archipin

    Joined:
    Dec 17, 2019
    Posts:
    35
    I found the editor code here, but it is internal class....
    What should I do...?
    I don't want to mess up original layout. Only thing I want is just putting a tiny button at the bottom.
     
  3. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    I think your only option is to create a new MonoBehaviour that requires a playable director, and write an inspector for it which adds the additional inspector buttons.
     
  4. jin-archipin

    jin-archipin

    Joined:
    Dec 17, 2019
    Posts:
    35
    upload_2020-5-6_11-38-19.png

    Do you mean this?
     
  5. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516