Runtime Pickup

epicever

Member
I am trying to get the animation to play when I pick up the item but none of the animator parameter values are changing when I pick the item up and I'm selecting the animator of the character not in the project tab. This item is also invisible in the hierarchy. This is a custom item I created.
1627357237708.png

1627357980598.png1627358125271.png
 
Is the item appearing in the character's Inventory as expected? You've set Animator Item ID to 100 - have you setup your animator controller to use that item ID for the animations for that item?
 
Yes it is appearing in the inventory and I believe I have the bare essentials to trigger an animation on equip but the parameter values aren't even changing when I pick up the weapon.
1627379199608.png1627382200237.png
 
Just so you have the workflow down have you followed the runtime pickup video and created a pickup using the demo assets? With that you should be able to follow the video step by step to get the workflow down.

Based on your screenshot though it doesn't look like the item is even trying to be picked up. Is the item on a layer that can collide with the character? Does ItemPickupBase.TryItemPickup get called?
 
Yes I followed it and could get animations working using AnimationIDs of existing animations from the demo (like 24 for Katana).

I added some debug.log to the start of the method and after the DoItemPickup and the DoItemPickup call happened when the statement was true if you needed that information.1627460297394.png
 
If the Slot0ItemID animator parameter is not even changing then that suggests that the item is getting picked up but not actually getting equipped upon being picked up. You could double check this by using the Animator Monitor component to log animator parameter changes.
 
Still doing testing but while I was switching between item collections I noticed that when updating the item collection it did not work when using the character manager. Pressing the "Update Character" button gave no message, no errors, but I could still change the Animator Controller using this method. Not the Item Collection. I had to manually change it in the item set manager on the character.
1627514912341.png
 
Last edited:
Ok I am able to receive Animator Monitor events and animations work when I use the DemoItemCollection even with a custom item type I created within DemoItemCollection. It's called MySwordDemoCollection (to separate it from the MySword item type I created for my own new Item Collection called MyItemCollection). I tested this by having the exact same items/animator/character/etc.. except for the Item Collection. I changed the item collection (DemoItemCollection) on the character to my own (MyItemCollection). The next thing I changed was the runtime item's Item Definition to the item type I created in MyItemCollection (which is called MySword). Then finally in the Item Pickup prefab I added the Item Definition Amounts for the type MySword. Those were the only differences in my testing and it appears the issue is with having an Item Collection that is not DemoItemCollection breaks the animator connection/events I guess. The three screenshots are the show the fields that I changed during my testing.

1627537366429.png1627537102913.png1627537249908.png
 
It appears that you are likely receiving collisions between item collections. There isn't anything inherently different about the demo item collection but if you have a mismatch of collections within the scene then things won't work correctly.

Can you create a new character and scene with your new item collection and try recreating the runtime pickup? This will ensure you are using the correct item collection.
 
Just some food for thought since it seems you have ran into a problem that may be similar to one I had.

Have you tried to create the Item directly to Nolan without using the Item pick up to make sure the item works? At one time I had ran into a problem where I created a weapon item and created directly to my character. But when I ran the scene it was doing the same thing in your video. I recreated my item collection but that didn't work. I figured out that the Animator ID was wrong. It seems that if the system can't find that Animator ID it nulls itself out.

One thing that you didn't show in the video was the Inventory component on Nolan. Is the weapon showing up in the "Current Inventory" and is bold with Slot 0 on it? When you pick up the Item is it being listed in the Inventory?

Something else you could try is using the default "ThirdPersonControllerDemo" animator and when creating the item on Nolan use the default animator ID of 22. This way you can make sure that the item is in the Inventory and equipped on Nolan. This way you can pen point if the problem is with the animator or something else.

Sadly one thing with UCC, it's heavily based on the Animator controller. I have tried creating my own from scratch but I ran into so many problems. The default animator is like a spider web that has so many layers that work between each other. What I have done myself is made a duplicate then copy paste Sub-State Machine from an existing one like the Sword and changed the condition number for the Slot0ItemID. This method seems to work for me. I'm just throwing that out there to see if that may help you.
 
Good insights @GearedGeek :)

The problem ended up being the ItemType's category not matching the EquipUnequip category. I should have pointed you to the Equip Unequip troubleshooting tips as that would have made this process a lot quicker but your issue is the second one listed. When you change the Equip Unequip's category you'll also want to change all of the equips (Equip Next, Equip Previous, etc) otherwise you'll get an error.

After you change that your character will start to equip, but it looks like there are some equip transition issues. To fix that on the Item component I disabled Wait for Animation Event and instead use a timer (this is the third tip on the Equip Unequip page). This equips the item, but the equip animation repeats due to the animator controller setup. At least the item appears now though!
 
Good insights @GearedGeek :)

The problem ended up being the ItemType's category not matching the EquipUnequip category. I should have pointed you to the Equip Unequip troubleshooting tips as that would have made this process a lot quicker but your issue is the second one listed. When you change the Equip Unequip's category you'll also want to change all of the equips (Equip Next, Equip Previous, etc) otherwise you'll get an error.

After you change that your character will start to equip, but it looks like there are some equip transition issues. To fix that on the Item component I disabled Wait for Animation Event and instead use a timer (this is the third tip on the Equip Unequip page). This equips the item, but the equip animation repeats due to the animator controller setup. At least the item appears now though!
WOOH! You don't know how happy I am that this is finally fixed. Much thanks for the time and effort.
 
Top