Hi, I have an Editor Component that needs to access the currently edited animation clip - the one currently present in the “Animation” window with the dope sheet editor. I basically am making a utility that will make some repetitive aspects of our animations easier to manage.
Is there any way to do this?
EDIT:
And/Or is there any way to get the current playhead position of the animation editor?
I can’t speak for OP, but we’re looking for a similar method for a slightly different use case. Basically we’ve got too many AnimationClips on some Animation components, so I’m trying to make an editor utility where you can choose an AnimationClip in the project, find all the GameObjects in the scene that have Animation components that contain that AnimationClip, and then when you select a given GameObject, it 1) highlights that GO, 2) opens the Animation window, and 3) selects the AnimationClip for editing.
Right now I can do 1) with Selection.activeGameObject, I can do 2) with EditorApplication.ExecuteMenuItem(“Window/Animation”); but I don’t know of any way to do 3).
So is there any way to get/set the currently-edited AnimationClip in the Animation window? (Get for OP, Set for me)
In 5.4 and previous:
Unless you absolutely must edit the clip on this GameObject, I’d suggest to copy the GameObject, put HideFlags.HideInHierarchy | HideFlags.DontSave on it (so it doesn’t pollute your scene), clear the clip array, and only set the one clip on the Animation component. This way, there’s only this clip to edit.
Bonus points: create a new scene and put it there.
It’s not perfect, but at least it lets you edit your clip.
So, we’re in Unity 5.6 now, and I’m looking to get the Playing animation from the Animation window - through script. I’m not finding much info on this.
Has a way to do this been added anywhere since last September?
Hello, I’m not sure if this is what you’re looking for but maybe this post might help anyone trying to add some extra things to the animation window.
I’ve actually managed to make a copy and paste function for an event through the animation window, which isn’t part of the animation window which is a bit wierd lol, and it seems to work quite well .