Runtime PickUp errors

Hamesh

Member
I have tried to create the sword runtime pickup from the video tutorial and unfortunately after each time I do things when I go to simulate the game I get a bunch of null reference exception and event handler errors. I have done this quite a few times now following the video exactly, I have even gone through the documentation version which has a few extra steps to the video, just to make sure I wasn't missing anything. I'm not sure if this is relevant, but when entering the pickup trigger there is the equip sound effect and the character animations change to the sword, but there is no sword model visible.

Here are the errors, I have noticed a few other posts about this but without solutions so I am wondering if there is a common mistake that maybe I'm making? Each of the null references are pointing to the same line in a different script: m_Character = characterLocomotion.gameObject;

1586439424364.png
 
Last edited:
I bet that you have the actual item in the scene, rather than it being a prefab. Make sure the pickup item in the scene does not have the Item component on it. It should be the Item Pickup component, created from the Object Manager:


You can also take a look at the bow/katana pickups from the demo scene for a reference.
 
The item is actually a prefab in the project view. I moved the item pick up prefab (created through the object manager window) into the scene and this does have both an Item script and an Item Pickup script, but I haven't made any changes to it so perhaps could the object manager be generating it incorrectly? In the video I did notice that the item pickup is a single gameobject (not including the weapon pad) while the one generated by the object manager is a parent with the item model as a child gameobject.

I do also have default Nolan in the scene but deactivated, who did have the items attached to him. So I deleted these from Nolan even though he was deactivated already, but unfortunately the same errors are still happening.

Here are my settings when generating the sword and sword pick up prefabs, is there anything I'm doing wrong:

1586526405647.png

1586526457203.png
 
Is the sword GameObject from the Object Builder the model file? I recreated this video for version 2.2 and was able to succeed using the same steps so I know that it works. When the item is picked up it should be able to find the controller references because it is a child of the character.
 
Oh it's the model file, I hadn't picked that up since it's mentioned quite quickly in the video. Thank you for that, that removed the errors.

I had thought that the sword wasn't displaying but after testing again after the above change, I realized it is actually there just incredibly small. It is about the size of the character's finger (71.65 scale is needed) even though the character model is a standard 1.8m tall. Yet when I drag the model file being used into the scene the size is as it should be. Is there any reason why this strange scale issue would be happening?
 
Just curious about the item scale issue mentioned above. This doesn't appear to happen on the Nolan character, so I am wondering why it is happening on a different character? I have gone through all of the bones and the scale is 1 from the hand bone all the way back up the chain to the root.
 
I'm not sure, but it does sound like it related to the scale of one of your parent bones. You can always adjust the scale factor in the model import settings.
 
Yeah very odd, I actually used the exact same character model for TPC1 and didn't have these scaling issues with the items. I will try a few more items and see if the issue is consistent.
 
Top