Search Unity

Question Discard modify serialised values of an object?

Discussion in 'Timeline' started by Cameron_SM, Jun 22, 2021.

  1. Cameron_SM

    Cameron_SM

    Joined:
    Jun 1, 2009
    Posts:
    915
    I have a system for moving units along a path in exact formations using the timeline. It's composed like so:

    Timeline track references the path asset in the scene. Each timeline clip on the path track references a "unit group" and a start and end waypoint. The system animates the unit group in formation from waypoint start to end across the span of the timeline clip.

    I have also written the behaviour code to move the units when scrubbing the timeline in the editor so the animators don't have to jump into and out of playmode to see how things will move but it's forever marking the scene as dirty and needing saving (cause stuff is moving around at edit time). Is there a way to move objects in the scene and not have those changes serialised/saved like the HideAndDontSave flag or something to that nature?

    Unity's built in animation system seems to be doing this somehow as you can see objects moving in the editor but it never dirty's the scene. I've searched a lot but haven't been able to turn up anything.

    Any assistance would be appreciated.
     
  2. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    Your PlayableAsset needs to implement IPropertyPreview, and register all the properties you plan to modify using the provided IPropertyCollector interface.

    If you need to know the serialized property name of the properties you want to modify, you can go to the Debug view in the inspector
    upload_2021-6-22_10-0-58.png

    Then hold the alt key while hovering over the inspector to show the serialized property names:
    upload_2021-6-22_10-1-59.png

    You can also find them by opening the scene files with a text editor (wordpad or other), as long as you have text serialization enabled.
     

    Attached Files:

    Cameron_SM likes this.
  3. Cameron_SM

    Cameron_SM

    Joined:
    Jun 1, 2009
    Posts:
    915
    Thanks David, very helpful!