NullReferenceException referencing method from a script

SlimDoughnut

New member
Inside my IvokeAction Method, I am calling a reload method from a script that is attached to my pistol item object that is spawned in the player's hand when equipped. Reload is supposed to reload the weapon's current ammo count equipped or unequipped.

InvokeAction:
ItemAction.JPG

Error:
image_2022-04-11_105605177.png
 
Well ItemUser is a component that usually sits next to your Inventory component on the character gameobject.
You just said your pistol is in the characters hand.

GetCachedComponent searches on the gameobject, not its children. You have to use GetComponentInChildren instead.
 
Top