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. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

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

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

  1. KevbotBrozan


    Nov 14, 2018
    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.