DeserializeAnimatorAudioStateSelector NullReference

RobotGames

Member
I updated to latest version and am having an issue with creating new MeleeWeapons:

Code:
Error: The AnimatorAudioState is null. Select the item MeleeItem within the inspector to serialize.
UnityEngine.Debug:LogError(Object)
Opsive.UltimateCharacterController.Items.AnimatorAudioStates.AnimatorAudioStateSet:DeserializeAnimatorAudioStateSelector(Item, UltimateCharacterLocomotion) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/AnimatorAudioStates/AnimatorAudioStateSet.cs:125)
Opsive.UltimateCharacterController.Items.Item:Awake() (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Item.cs:245)

I have started new chars from scratch and get this error. Any Ideas? Existing chars are fine. I copied an existing weapon from an older char and all was good.
 
Last edited:
This relates to the melee item not completely initializing. To expand on the error message, if you inspect the Melee Weapon component it will then serialize the required data.
 
Hello Justin, In my case I had the same issue creating a new assault rifle item, I've solved the issues by assigning the audioclips missed, but all the sounds work as expected except the equip audioclip. Do you know why is it happening? I've tried to fix it changing to the selector option to Random, also I've added 2 or 3 audioclips but nothing works.

This is my Item script

1465

Thanks in advance,
Martin
 
I am having the same issue except that I am using third person shooter components. I just updated to the newest version and got these errors and my character will no longer attack. Clicking on the pistol weapons in the inspector does not serialize. It does nothing.

1466
 
This relates to the melee item not completely initializing. To expand on the error message, if you inspect the Melee Weapon component it will then serialize the required data.

I have of course inspected the MeleeWeapon component, I have opened it and added AnimatorAudioStates since I have like four. It still works but apparently it is only when the thing is initializing or first use?

I'd also add that I am on Unity 2019.1.9f1 It was update day.
 
Last edited:
Hello Justin, In my case I had the same issue creating a new assault rifle item, I've solved the issues by assigning the audioclips missed, but all the sounds work as expected except the equip audioclip. Do you know why is it happening? I've tried to fix it changing to the selector option to Random, also I've added 2 or 3 audioclips but nothing works.
Equip won't play if the item is being equipped instantly (such as at the beginning of the game). If you are switching weapons though the sound should play - if you can tell me how to reproduce it within the demo scene when it doesn't play I can take a closer look.

I am having the same issue except that I am using third person shooter components. I just updated to the newest version and got these errors and my character will no longer attack. Clicking on the pistol weapons in the inspector does not serialize. It does nothing.
I have of course inspected the MeleeWeapon component, I have opened it and added AnimatorAudioStates since I have like four. It still works but apparently it is only when the thing is initializing or first use?
When you updated UCC, did you first remove the Opsive/UltimateCharacterController folder? The only change related to the AnimatorAudioState in this past update was that the folder for the animator audio state inspector was renamed so my guess is that the old code may still be running if you didn't first completely remove the UCC directory.

Beyond that if you are able to list the steps to reproduce from a fresh UCC project I can take a look.
 
If you can follow the bug report format and list the steps to reproduce from a fresh project that would be great.

 
OK I removed everything and reimported, UCC, Behaviour Designer, Movement etc. Still there. Finally figured out how to get rid of it, I was looking at MeleeWeapon when it was Item that needed to reserialize. I selected AllowDuringMovement in Unequip and it went away. I couldnt just inspect it I had to actively make a change. but It works fine now.
 
If you can follow the bug report format and list the steps to reproduce from a fresh project that would be great.


Okay so this problem is not fixed by what RobotGames specified. At least for me it didn't.

1. Third Person Controller
2. Unity Version 2019.1.7f1
3. All attacks on the melee weapon are unable to play except for the original attack. All of the other melee weapon component attacks on the same item do not work and get error messages saying to serialize.
4. Start a new scene and create a new character. Create a melee weapon and add 3 more melee weapon components to the item. The other 3 added should add the error.
5. 1479
 
Thanks - I was able to reproduce it. Within AnimatorAudioStateSet change the AnimatorAudioStateSet constructor to:

Code:
        public AnimatorAudioStateSet()
        {
            var animatorAudioOutputSelector = System.Activator.CreateInstance(typeof(Sequence)) as AnimatorAudioStateSelector;
            m_AnimatorAudioStateSelectorData = Serialization.Serialize(animatorAudioOutputSelector);
        }
 
Amazing. Thanks alot justin! Its fixed.
Even after I edited the code it still didnt fix the existing problem until I removed the extra components besides the initial first one and then readded them all using the main manager.
 
Amazing. Thanks alot justin! Its fixed.
Even after I edited the code it still didnt fix the existing problem until I removed the extra components besides the initial first one and then readded them all using the main manager.

Hey, I have the same problem. Editing the code as Justin said did not fix it. I don't understand your method: "removed the extra components besides the initial first one", would you mind explaining it more detail?
 
Hey, I have the same problem. Editing the code as Justin said did not fix it. I don't understand your method: "removed the extra components besides the initial first one", would you mind explaining it more detail?
For my instance I have multiple melee weapon components on one weapon with different action id. Through the opsive main manager I selected the existing weapon on my character and removed all of my melee weapon components except for action id 1. Which is melee component 1.

If it doesnt work for you then maybe try removing all melee weapon components and then readd or even possibly remake your item.
 
I just created only one weapon (Assault Rifle) and I got this problem. I had deleted the old UCC before imported the new one, but god, there are some many problems appeared.
 
I get rid of these errors by copying all values of all components from Nolan's Assault Rifle weapon in the demo scene to my character's Assult Rifle. It seems the default value did not work, you need to settings something to get rid of those errors. That's strange!
 
Top