I need to add some animation events or copy them from other models. So I decided to make a EditorWindow. Unfortunately there's not much information about this, and I'm stuck in here.
void OnGUI() {
GUILayout.Label("Source Object contains Animation Clips", EditorStyles.boldLabel);
sourceObject = (GameObject) EditorGUILayout.ObjectField(sourceObject, typeof(Object), false);
if(GUILayout.Button("Copy")) {
if(sourceObject == null) {
throw new System.NullReferenceException("Source Object is missing.");
}
// Do Copy here
}
}
What I need to do is:
- Extract all animation clips from the selected model(fbx) - it's the source object
- Select "AnimationClip" to want to copy. Note that AnimationClip in here is not inside of model, it's seperated AnimationClip that duplicated from original model because basically animation clip from imported model is read-only, so I have to duplicate to update it.
How do I get animation clips from selected fbx model with ObjectField? Any advice will very appreciate it.