Status
Requested
Complexity
6/10
Description
Ability to save Unity Animator components.
This is not automatically serialisable, so further exploration would be needed to understand whether it can be serialised using its Get/Set methods. As such, this is not trivial to implement.
Support for serialising Animators
- AdamStepinski
- Posts: 11
- Joined: Wed May 05, 2021 8:44 am
Re: Support for serialising Animators
+1, when loaded, Animator loses "Controller" field
My solution: have singleton with RuntimeAnimatorController field
Create script on your animator and in Start():
My solution: have singleton with RuntimeAnimatorController field
Code: Select all
public class EasySaveReferenceHelper : MonoBehaviour
{
public static EasySaveReferenceHelper Instance;
public RuntimeAnimatorController CharRuntimeAnimController;
private void Awake()
{
Instance = this;
}
}
Code: Select all
private void Start()
{
Animator charAnimator = GetComponent<Animator>();
charAnimator.runtimeAnimatorController = EasySaveReferenceHelper.Instance.CharRuntimeAnimController;
}
Re: Support for serialising Animators
I am also hoping for this feature as I am loading the animator controller from an accessibles directory when I instantiate my prefab. If I can't save my runtime animator controller, I will have to reload it again from the accessibles directory when the saved prefab is loaded which is not ideal.