- Home /
AnimationEvent.objectReferenceParameter being nulled and giving dontDestroyOnLoad issues
Can anybody shed some light on these odd observations?
I wanted to carry multiple data through Unity's animationEvent-system, so I created a subclass of ScriptableObject to hold my data, and fed instances of this class to AnimationEvent.objectReferenceParameter.
This worked as long as I stayed in the same scene, but when I changed scene, I first experienced that the callbacks from the Animation arrived with the Object-parameter as null, and subsequently that Unity started to log the dreaded message about "Some objects marked as dontDestroyOnload had their parents killed usw..."
When I keep to using the AnimationEvent.stringParameter, i don't experience nulling of the animationEvent parameter, nor dontDestroyOnload-issues.
The reason I subclass from ScriptableObject is that otherwise the AnimationEvent.objectReferenceParameter is ignored because it is typed as 'Object' with a capital 'O' i.e. it's the UnityEngine.Object not the 'ordinary' C# 'object'.
I have now discarded using AnimationEvent.objectReferenceParameter, and reverted to using AnimationEvent.stringParameter.
Your answer

Follow this Question
Related Questions
why I can't pass the param AnimationEvent.objectReferenceParameter,it's always null in even 1 Answer
Instantiate gameObject returns null? 1 Answer
NullReferenceException when assigning a parent to an instatiated object. 1 Answer
Dealing with nulls on Respawn 1 Answer
The object of type 'Transform' has been destroyed but you are still trying to access it. 0 Answers