ChildAnimatorMonitor.SetItemIDParameter NullPointer exception

Hi,

I've noticed that I get this exception sometimes (using UIS + UCC for my rifle), because of likely a corrupted save file, but still I'd rather fix it. So what happens is when I load my character I call this

private void LoadDefaultCheckpoint(Transform theDefaultCheckpointTransform)
{
SetPositionAndRotation(theDefaultCheckpointTransform);
}

public void SetPositionAndRotation(Transform tr)
{
_ucc.SetPositionAndRotation(tr.position, tr.rotation, _snapAnimator, _stopAllAbilities);
}
I'm pretty sure this code is causing it because when I delayed it with 2 seconds the error was gone. I tried to setPositionAndRotation without using the snapAnimator and stopAbilities function but the error was still there. It points to the game object with the name "Game" that holds the managers.

This is the full error and as it says m_ItemParameterExists is actually NULL (its not initialized in its Awake function).
NullReferenceException: Object reference not set to an instance of an objectOpsive.UltimateCharacterController.Character.ChildAnimatorMonitor.SetItemIDParameter (System.Int32 slotID, System.Int32 value) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/ChildAnimatorMonitor.cs:492)Opsive.UltimateCharacterController.Items.CharacterItem.SetItemIDParameter (System.Int32 slotID, System.Int32 value) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/CharacterItem.cs:1108)Opsive.UltimateCharacterController.Character.AnimatorMonitor.SetItemIDParameter (System.Int32 slotID, System.Int32 value) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/AnimatorMonitor.cs:933)Opsive.UltimateCharacterController.Character.AnimatorMonitor.UpdateItemIDParameters () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/AnimatorMonitor.cs:1231)Opsive.UltimateCharacterController.Character.AnimatorMonitor.UpdateAnimatorParameters () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/AnimatorMonitor.cs:439)Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.UpdateCharacter () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:595)Opsive.UltimateCharacterController.Character.CharacterLocomotion.Move (System.Single horizontalMovement, System.Single forwardMovement, System.Single deltaYawRotation) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/CharacterLocomotion.cs:565)Opsive.UltimateCharacterController.SimulationManager+SmoothedCharacter.Move (System.Boolean preMove) (at Assets/Opsive/UltimateCharacterController/Scripts/Game/SimulationManager.cs:169)Opsive.UltimateCharacterController.SimulationManager.MoveCharacters (System.Boolean preMove, System.Single interpAmount) (at Assets/Opsive/UltimateCharacterController/Scripts/Game/SimulationManager.cs:723)Opsive.UltimateCharacterController.SimulationManager.FixedUpdate () (at Assets/Opsive/UltimateCharacterController/Scripts/Game/SimulationManager.cs:671)

I renamed my save file then gave it back the original name and now the error seems to be gone, but I've seen it reported multiple times during the months. The ChildAnimatorMonitor we are referting to is of my Rifle spawned by UIS.
 
Sounds like there could be some exceution order issue here where certain scripts are running before others causing the issue.
I could add a simple null check where the error happens, but that probably won't be a real fix.

Is there anyway you could send me a quick repro project or some instruction on how to reproduce this issue in the demo scene? I I can reproduce it on my end I can check the order and investigate what the real cause is
 
Yes adding a null check just made other methods from the same script blow up. What I posted on Discord is

this is veery hard to repro now i cant even do it but i guess one reason might be that in my menu im disabling the player model along with the skeleton that holds the rifle so maybe rifle is spawned in a disabled hierarchy its Awake never gets called and for some reason something is trying to call that method on it (from the outside)
  • I will try to not disable the rig and hide the player somewhere by moving it far away from the camera (in the main menu) and test that way.

My Player object (containing UCC + UIS scripts) stayed active but the view (containing the rig therefore the rifle) was disabled
 
Back
Top