Support for serialising Animators

Vote for new features, or make your own requests here.
Post Reply

Support for serialising Animators

Yes, I would like this feature
5
100%
No, I would not like this feature
0
No votes
 
Total votes: 5

User avatar
Joel
Moodkie Staff
Posts: 4825
Joined: Wed Nov 07, 2012 10:32 pm

Support for serialising Animators

Post by Joel »

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.
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
User avatar
AdamStepinski
Posts: 11
Joined: Wed May 05, 2021 8:44 am

Re: Support for serialising Animators

Post by AdamStepinski »

+1, when loaded, Animator loses "Controller" field

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;
	}
}
Create script on your animator and in Start():

Code: Select all

private void Start()
{
	Animator charAnimator = GetComponent<Animator>();
	charAnimator.runtimeAnimatorController = EasySaveReferenceHelper.Instance.CharRuntimeAnimController;
}
syu15
Posts: 16
Joined: Thu May 13, 2021 1:05 am

Re: Support for serialising Animators

Post by syu15 »

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.
Post Reply