- Home /
How to tell if an animation clip is playing in the editor(NOT in playmode) with an editor script
Hi! I'm trying to tell if an animation clip is playing in the inspector. This clip is just being played from an animation clip inspector. Is it possible to tell if an animation clip is playing in the editor preview window and not in the game? I've been trying to do it with reflection by trying to access the AnimationInspectorEdtior and getting the animation controller from it but am unsure how to get my specific instance of this AnimationInspectorEditor(this is also the first time I've tried to use reflection so its entirely possible I'm doing it wrong). If anyone knows of a better way/has a solution please share.
Answer by shadowpuppet · Apr 20, 2017 at 07:18 PM
if I understand your question, if the model is selected ( with animation on it) and it appears in the inspector, just hit the play button and there is a little red line ( playhead) that moves across as the clip plays ( if it is playing). If nothing appears in that window ( for animations imported without a model) drag the appropriate model for that animation into the play window
Hi Shadowpuppet. I'm not simply trying to preview an animation in the editor, I'm trying to tell what animation is being previewed. I want something else to happen when the animation is previewed. This is for a tool I'm working on. I used reflection to end up with two inspector windows at the same time, one of them created by code when an animation is put into my animation clip variable, the other one is a custom inspector for a custom serializable object. I want to be able to tell when that animation is playing in the editor, not in the game.