Search Unity

Question want to create Playable clip that changes texture variable of a RawImage component

Discussion in 'Timeline' started by metaphysician, Sep 16, 2021.

  1. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    190
    hey folks i'm trying to create a Playable clip type that will change the texture variable of a RawImage component. the Wizard doesn't really help because exposed references and variables seem to only be able to select Components and not Assets. it doesn't seem like this would be super difficult but the Default Playables package doesn't get me there either.

    i just want to be able to create a RawImage bound track and line up clips containing texture asset references to change the texture variable in the component on a Game Object. i did find a GitHub repo covering doing animation for all the UI elements including RawImages but again it only covers RectTransform and Color and NOT texture variables. it seems like it could be modified to cover these but i'm a little bit at sea with the Playable methods, and so far all my searches have not turned up anything worthwhile. any assistance appreciated!
     
  2. Cameron_SM

    Cameron_SM

    Joined:
    Jun 1, 2009
    Posts:
    915
    Have you tried simply not using ExposedReference<T>?

    As the asset (Texture) you want to reference is not in the scene it shouldn't be needed. The timeline is basically a scriptable object with lots of sub-objects inside it so technically you shouldn't have any issues referencing another asset in the project outside of a scene. Just like a prefab can reference other project files but not stuff in a scene).

    It's when you want to reference something inside a scene from the scriptable object that you need to go through an ExposedReference<T> - which can also be used on plain old scriptable objects which is kinda cool.

    I've not actually tried to do that before though so let us know if that works.
     
    Last edited: Sep 17, 2021