Search Unity

ExposedReference - exposedName PropertyDrawer

Discussion in 'Timeline' started by mathiastg, Sep 11, 2017.

  1. mathiastg

    mathiastg

    Joined:
    Jun 3, 2016
    Posts:
    4
    By random luck I find that you can display the exposedName field of a ExposedReference in the inspector.


    https://i.imgur.com/bto7mqJ.png

    However, I had to assign the the field (.exposedName) manually by iterating through the tracks and their clips to access it. If you clear the textfield it returns to the normal inspector and you have to set the exposedName by code again to make it show up in the inspector again.

    1. Is there a reason this is not the default behaviour when selecting "Expose Property"? Am I missing something?

    After finding out you can do this in the inspector we're gonna be able to shift more stuff over to the designer(s) and overall it's gonna be a lot easier to decouple the timeline from specific gameobjects etc. Basically we have a lot of the same timeline/functionality executed at different times, on different gameobjects and even different scenes. With this - we can just name the exposed reference and somewhat generically check in a lookup table to which GameObject/Component/Etc it corresponds to.

    2. Wouldn't it make sense to have the above mentioned system directly in the PlayableDirector? Similar to what the bindings display in the inspector but instead of the track name being the key it would be what the .exposedName on the all of the ExposedReference. If you had duplicates it would simply point to the same object?

    3. Currently just considering making an editor script that finds all ExposedReferences and sets the exposedName to a bogus/temp value so you can access the inspector for it. Is there any reason this could be a bad idea?
     
    Last edited: Sep 11, 2017
  2. mathiastg

    mathiastg

    Joined:
    Jun 3, 2016
    Posts:
    4
    Bump!

    I've tried the above approach somewhat (setting the default to something bogus) and it works well so far, but of course if you leave the field empty you need to reset it by code again. Just feels wrong though, any thoughts?
     
  3. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    763
    Found out about this yesterday, whilst trying to build a master timeline from all other timelines found in the loaded scenes. My problem was the three clips were being added, but all with the same timeline. Turned out I had to rename exposedName of each ControlPlayableAsset after creating, but before assigning.

    That's at run time though, we're also in need of something in the editor, I agree it would be super useful to have this variable visable by default.