NullReferenceExceptions on client for the grenade pickup in demo scene

ChristianWiele

Active member
Hi,

in the PUN demo scene I get 2 different NullReferenceExceptions on the client:

1.) If the player on the master client throws a grenade, the following exception occurs on the client:
Code:
Opsive.Shared.Game.ObjectPoolBase.Destroy (UnityEngine.GameObject instantiatedObject) (at <52a41b32fbc54a60add8140e367dde46>:0)
Opsive.UltimateCharacterController.Items.Actions.ThrowableItem.ThrowItem () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/ThrowableItem.cs:499)
Opsive.UltimateCharacterController.Items.Actions.ThrowableItem.StopItemUse () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/ThrowableItem.cs:622)
Opsive.UltimateCharacterController.Character.Abilities.Items.Use.AbilityStopped (System.Boolean force) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Items/Use.cs:866)
Opsive.UltimateCharacterController.Character.Abilities.Ability.StopAbility (System.Boolean force, System.Boolean fromController) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Ability.cs:692)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStopAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability, System.Boolean force) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1440)
Opsive.UltimateCharacterController.AddOns.Multiplayer.PhotonPun.Character.PunCharacter.OnItemAbilityActiveRPC (System.Int32 itemAbilityIndex, System.Boolean active) (at Assets/Opsive/UltimateCharacterController/Add-Ons/Multiplayer/PhotonPUN/Scripts/Character/PunCharacter.cs:232)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
Photon.Pun.PhotonNetwork.ExecuteRpc (ExitGames.Client.Photon.Hashtable rpcData, Photon.Realtime.Player sender) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:540)
Photon.Pun.PhotonNetwork.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2199)
Photon.Realtime.LoadBalancingClient.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3285)
ExitGames.Client.Photon.PeerBase.DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer stream) (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PeerBase.cs:891)
ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/EnetPeer.cs:559)
ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands () (at D:/Dev/Work/photon-dotnet-sdk/PhotonDotNet/PhotonPeer.cs:1837)
Photon.Pun.PhotonHandler.Dispatch () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:223)
Photon.Pun.PhotonHandler.FixedUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:149)

2.) If the client player picks up a grenade, this exception occurs:

Code:
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Inventory.ItemDefinitionAmount.get_ItemIdentifier () (at Assets/Opsive/UltimateCharacterController/Scripts/Inventory/ItemDefinitionAmount.cs:32)
Opsive.UltimateCharacterController.Character.Abilities.PickupItem.AbilityStarted () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/PickupItem.cs:201)
Opsive.UltimateCharacterController.Character.Abilities.Ability.StartAbility (System.Int32 index) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Ability.cs:466)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability, System.Boolean ignorePriority, System.Boolean ignoreCanStartCheck) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1198)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability, System.Boolean ignorePriority) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1065)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1054)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.UpdateAbilities (Opsive.UltimateCharacterController.Character.Abilities.Ability[] abilities) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:783)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.UpdateUltimateLocomotion () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:724)
Opsive.UltimateCharacterController.Character.CharacterLocomotion.Move (System.Single horizontalMovement, System.Single forwardMovement, System.Single deltaYawRotation) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/CharacterLocomotion.cs:477)
Opsive.UltimateCharacterController.Game.KinematicObjectManager+KinematicCharacter.Move (System.Boolean manualMove) (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:237)
Opsive.UltimateCharacterController.Game.KinematicObjectManager.FixedUpdate () (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:880)

I am using the following versions:

Unity 2020.2.6
UCC 2.3.1
PUN add-on 1.1.10
Photon 2.28.1

Regards, Christian
 
Things look like they aren't fully fleshed out with the new PUN changes. I will take a look and release an update with this, it'll likely be next week.
 
I looked into this and this was only problem for the middle grenade on the first floor of the demo scene. There were two references to null Item Definitions. Easy fix :)
 
Just checked again. The first exception occurs for any throwable object, and any grenade in the demo scene, not just the middle one.
 
Top