Following Opsive Youtube video, but getting erros and missing components

TDM GameDev

New member
Hello, I am following along with the video about the Ultimate Inventory System / Character Controller integration:

When I get to the point after the timestamp in which the "Equip On Pickup" functionality is illustrated, I start getting errors:

1650381090551.png
1650381105374.png


The NullReferenceException is thrown at this line in BridgeEquippableProcessing.cs (line 272):
C#:
var itemObject = characterItem.GetComponent<ItemObject>();

I can just add the missing script to the player character, but it seems like it should have been added already by one of the setup steps? Also, in the video, the character has child GameObject called Items with the assault rifle as a child:
1650381432286.png

Shortly after that point in the video there are other child GameObjects of the Items GameObject. Where did this GameObject come from? Did I miss some other part of the setup? This is the first point in the video where I encountered any problems, and I was careful to follow along with all of the steps to make sure I didn't miss anything, but obviously I missed something because these errors do not occur in the video.
 
Whn you have errors you should always fix them in order. In many cases the first errors causes all the ones after. That's because an error breaks the flow of the code which prevents many things from running or initializing.

The first error says that ItemPlacement is missing from your character. That's the component where items logic will be spawned too (the models are spawned in the ItemSlots)
1650436244278.png

It should haven been added automatically when you created the character, so that's a bit odd.
Let me know if that fixes all your issues

(The second error shouldn't happen after this fix. Normally if the ItemObject doesn't exist it is added automatically)
 
Whn you have errors you should always fix them in order. In many cases the first errors causes all the ones after. That's because an error breaks the flow of the code which prevents many things from running or initializing.

The first error says that ItemPlacement is missing from your character. That's the component where items logic will be spawned too (the models are spawned in the ItemSlots)
View attachment 8614

It should haven been added automatically when you created the character, so that's a bit odd.
Let me know if that fixes all your issues

(The second error shouldn't happen after this fix. Normally if the ItemObject doesn't exist it is added automatically)

I actually did add that script to the player GameObject in my first attempt to fix the error, but since I just got a new NullReferenceException when I did that, and I wasn't sure about the Items child GameObject or what scripts might be on it, I undid that attempt to fix it. Following your instructions, I added the Items GameObject and now when I attempt to interact with the item that has the Inventory Item Pickup script with the Equip on Pickup checkbox checked, I get the aforementioned NullReferenceException (I'm assuming it's the same from when I added the Item Placement script to the Player GameObject, but I'm not 100% sure about that.

1650463047055.png

This is the code that seems to be throwing the exception, according to the error in Unity (on line 179):

1650463315345.png
 
Most likely that means you are missing the item ability for Equipping/Unequipping items. (Or that your ITemSetManager is missing or not initialized but that's less likely).

It seems your character didn't get setup correctly, I'm not sure why. I would recommend you open the Integration demo scene and compare your characters abilities with the demo characters abilities (especially the Item Abilities)

If you aren't sure also send me a screenshot of your character inspector
 
Most likely that means you are missing the item ability for Equipping/Unequipping items. (Or that your ITemSetManager is missing or not initialized but that's less likely).

It seems your character didn't get setup correctly, I'm not sure why. I would recommend you open the Integration demo scene and compare your characters abilities with the demo characters abilities (especially the Item Abilities)

If you aren't sure also send me a screenshot of your character inspector

So, after I gave up trying to get this to work and taking a break, I decided to start over from scratch. That's what I did yesterday, and things seemed to be going well. The Items GameObjects had been added to my player character correctly, and I seemed to have all of the script components. When I got to the point in that video where things didn't work the first time around, I was pleasantly surprised to find that my character did actually equip the sword in his right hand (mostly). I followed along with the part about rotating the Assault Rifle (in the video it's an assault rifle), and noticed that when I attacked with the correctly positioned sword, the left hand got janky.

I found this page: https://opsive.com/support/document...controller/items/actions/usable/melee-weapon/ which kind of explained the problem, but the process for fixing it wasn't really clearly described, so I watched this video:

I followed along until I got to the point in the video where the narrator actually started fixing the janky left hand. My problem is that my character does not have a component called "Item Set Manager". I am using the Third Person Character Controller with the Inventory System integration, so I assume that is the reason that I have something called "Inventory Item Set Manager" instead.

So, I added a "Sword" state in the Character IK component, and then went to my Inventory Item Set Manager component to try to add the Sword state there, despite the interface not looking exactly like the one in the video. I have not been able to duplicate the results in the video that show the left hand animating correctly. This is what my Inventory Item Set Manager component looks like:
1650902149406.png

And here is what the Item Set Manager looks like in the video:
1650902195278.png

I also attempted to add the Item Set Manager to my character manually. It did not go well. Doing that and attempting to duplicate the setup in the video leads to errors as soon as I start playing:
1650902416789.png

I can only assume that the problem is not that the Item Set Manager script is missing and that I was correct in thinking that the Inventory Item Set Manager is its replacement, so there must be some problem with how I tried to add the state to that component. If someone could tell me what I've missed, that would be lovely. I'm getting very frustrated with how much time I'm spending just trying to get these assets to work, despite the fact that they are supposed to integrate mostly seamlessly. I'm not whining because I want a refund, or something. I just want this to work.
 
I followed along until I got to the point in the video where the narrator actually started fixing the janky left hand. My problem is that my character does not have a component called "Item Set Manager". I am using the Third Person Character Controller with the Inventory System integration, so I assume that is the reason that I have something called "Inventory Item Set Manager" instead.
That is correct, in the Integration the "Inventory Item Set Manager" replaces the "Item Set Manager"
It functions slightly differently as in you can only add items dynamically at runtime. And this is done by the ItemSetRules
Make sure you read the documentation page to understand correctly what is an ItemSet, ItemSetRule and CategoryItemSetRule:

I would recommend you read carefully the whole thing, especially the section about the InventoryItemSetManager


This is what my Inventory Item Set Manager component looks like:
Your Inspector looks weird, if you check the documentation you'll see that it does not exactly look the same. It looks like it's just a styling issue though not something that would cause problems. Do let me know the exact Unity, UIS and UCC, and integration versions you are using so that I can test it and fix it if it is a bug

I think you haven't understood how the state system works.

When the Sword is added to the character, the ItemSetRule creates an ItemSet. When that sword ItemSet is equipped the state you set will become active. In the screenshot above you haven't set any state name. You need to create a ItemSetRule for your sword and call it "Sword":
1650905186944.png

Then the MeleeCharacterIKPreset. Is the preset you have to add on the "CharacterIK" component, not on the ItemSet (I could be wrong about that part, it has been awhile since I touched the character IK stuff)

I hope with this you'll be able to get it working like you want to.
 
I would recommend you read carefully the whole thing, especially the section about the InventoryItemSetManager
I will do that, and see if I can use that documentation and resolve things. You are not wrong about me not understanding the state system. That video about melee weapon setup was the first time I can remember hearing it discussed in more than a passing context, if at all. It's hard to know what documentation to even look for as unfamiliar as I still am with the complexities of these systems. I am looking forward to being familiar enough with everything to be able to start a new project and set things up without needing to follow along with multiple videos and reading dozens of pages of documentation every time.

Your Inspector looks weird, if you check the documentation you'll see that it does not exactly look the same. It looks like it's just a styling issue though not something that would cause problems. Do let me know the exact Unity, UIS and UCC, and integration versions you are using so that I can test it and fix it if it is a bug
I noticed it during my first attempt. It's irritating, but I didn't mention it because I just assumed it was a styling issue. Here are the versions of everything I'm using in the project you see in the screenshots:
Unity 2021.3.0f1
Third Person Controller 2.4.7
Ultimate Inventory System 1.2.7

P.S.
Thanks for your fast response!
 
For the styling problem. Add this line of code in InventoryItemSetManagerInspector on line 54:

Code:
container.styleSheets.Add(InventoryManagerStyles.StyleSheet);

I'll update the integration on our website asap
 
Top