- Home /
Recommendations on managing and finding animations within a project
I'm looking for best practices on the storage and naming of animation sequences and the best way to figure out what animations are available in an existing project.
For instance, many animations are 1 step in a larger sequence of animations, so if I select the object, and then replay the animation sometimes its a very short one and making sense of it is difficult.
Are there some organization tools to help me find associated animations (Unity animations, not model animations) Or select an animation, and then have it find all the objects that use it? Or what about selecting an animation, and then with a button press, it goes into the scene, and finds any instance of an object who's properties and recursive children match up with the naming of the animation nodes?
Any advice of what people do to simplify there management of Unity animations would be appreciated.
Answer by DanVioletSagmiller · Jun 09, 2019 at 04:12 AM
I'm adding a note on a path I've started taking. I've created a very simple Script called SceneEvent. It has a method called invoke, and a UnityEvent. Under my object, I create an Empty object, called Events, and then create different children with names matching the animation purposes. Then add scene event, and set that up to call the appropriate animation. My scripts then reference SceneEvents.
This makes the animations highly visible, and can be executed either by things referencing scene events, or by a separate UnityEvent. This has proven 10 times easier than having to flip through multiple panels, and then re-select the object. after having selected the animation, so I can test and see what it does. That process has been a pain.
This process is 10 times easier, where I can just click Invoke (a custom inspector button that triggers the event) and see what happens. So much easier. I might include a description field to optionally add detail to what happens. Additionally, the triggering of it, at present, logs the "Event: [name]" making it easy to track the order of execution and debug.
Here is the code sample, if anyone is interested:
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
#if (UNITY_EDITOR)
using UnityEditor;
#endif
namespace Dvs.VirtualTheatre
{
public class SceneEvent : MonoBehaviour
{
public UnityEvent Event;
public void InvokeEvent()
{
Event.Invoke();
}
}
#if(UNITY_EDITOR)
[CustomEditor(typeof(SceneEvent))]
public class SceneEventEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
if (GUILayout.Button("Invoke"))
{
((SceneEvent)target).InvokeEvent();
}
}
}
#endif
}
I'd be interested to get other people's take on this as well.
- Thanks.
Now that I've been using this for a few days, it has become clear that this is working well. I have a log that clearly expresses everything in order, so I can see what is happening and find breakdowns in sequences very easily. I'm able to return to older objects, and not have to remember what they did. Its very easy to just expand the Events child and find out by looking at it. I can make changes live, and trigger them when an animation doesn't work as expected.
I'm still very open and interested in hearing others experiences. I'm very good at coding, so solution was to hit this with code. I'm open to entirely different ways of thinking if someone cares to take the time or post a link to another video/article.
Your answer
![](https://koobas.hobune.stream/wayback/20220612202418im_/https://answers.unity.com/themes/thub/images/avi.jpg)