Search Unity

Question Editor Script to add specific properties of gameObject to keyframe of animation

Discussion in 'Animation' started by KevbotBrozan, Mar 17, 2023.

  1. KevbotBrozan

    KevbotBrozan

    Joined:
    Nov 14, 2018
    Posts:
    1
    Hey everyone,

    I'm making some editor scripts that are very specific to my animation production workflow, and one issue I'm trying to solve is that I want to programatically add specific properties of all child game-objects to a keyframe of the animationClip that is currently open.
    This includes various things like: transform properties, sprite renderer sprite/flip/enabled, things like that.

    I'm basically trying to bake the first frame as a source of truth for all of the relevant properties, as previous animations may have left the gameobject in a weird state.

    How does one interact with the clip that is currently open by the editor and add properties? Is this API even available? Iterating through the prefab is simple enough, but what's escaping me is the interaction point with the current clip/frame.