- Home /
Setting keys in Animation Editor through Editor code
I am assigning the position and rotation of objects with a custom editor script for streamlining an operation however when the position of an object (child object) is assigned through code it does not set a keyframe in the animation editor. Usually you would just select the child object and then move it with the tools and it will automatically create a keyframe, however I want to move many children through code in my editor script.
Is there a way for me to create a keyframe on the current frame of the animation editor for these objects?
Here is an example of what I mean by moving an object in code:
obj.position = Handles.PositionHandle(obj.position, obj.rotation);
The object on the right of the above image has the code listed applied to it, so the object is moved through code with coded handles.
Notice that when I move the object the animation editor does not automatically create frames for its changed properties.