Opsive UCC and UIS doesnt find the Inventory

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
freddyatlantis
Posts: 3
Joined: Tue Apr 09, 2024 3:49 pm

Opsive UCC and UIS doesnt find the Inventory

Post by freddyatlantis »

Hi all,
I have a Unity game using the Opsive UCC and UIS. I'm using the UIS DS Demo Database, and talking to the Guide, who offers me a Great Sword. The Great Sword is in my UIS Item Definitions Manager.

The dialogue triggers fine, but when the Dialogue Manager get to the

Code: Select all

uisGetItemAmount("Great Sword", "") == 0

script, I get an error that it cant find my Inventory;

Code: Select all

Dialogue System: Can't find Inventory on 'Player 1'.
UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
PixelCrushers.UISSupport.UISLua:GetInventory (string) (at Assets/Pixel Crushers/Dialogue System/Third Party Support/Opsive UIS Support/Scripts/UISLua.cs:174)
Yeah, I have the Inventory Component added to the player, so did I miss something at setup?
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Opsive UCC and UIS doesnt find the Inventory

Post by Tony Li »

Hi,

Is there an Inventory component on the GameObject named 'Player 1' or its children?

Are there more than one GameObject named 'Player 1'?

Are there any other errors or warnings in the Console before this one?
freddyatlantis
Posts: 3
Joined: Tue Apr 09, 2024 3:49 pm

Re: Opsive UCC and UIS doesnt find the Inventory

Post by freddyatlantis »

Thanks for the reply.
Yes, I have an Inventory Component on Player 1.
No, there are no other GameObjects with the same name.
And I only get the following warning, which is related to Rewired:

Code: Select all

Rewired: The Action "Cancel" does not exist. You can create Actions in the editor.
I did check the GetInventory function, and it looks straightforward. Putting a Debug.Log in there returns the correct subject, but returns null for the inventory var.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Opsive UCC and UIS doesnt find the Inventory

Post by Tony Li »

If you click on the warning message while in play mode, it will highlight 'Player 1' in the Hierarchy view. Does it highlight the correct GameObject? If so, is it possible that something has removed its Inventory component at runtime?

If none of that helps, can you send a reproduction project to tony (at) pixelcrushers.com?
freddyatlantis
Posts: 3
Joined: Tue Apr 09, 2024 3:49 pm

Re: Opsive UCC and UIS doesnt find the Inventory

Post by freddyatlantis »

Yeah, the problem was in my setup.

I had a bit of trouble getting the dialogue to start when the trigger was set to OnUse, so I had both the top level Player 1 AND the second level Player 1 Model tagged as "Player". Once I removed the second label, everything works perfectly.

Sorry that I pulled the trigger on a new post prematurely, and thanks for your effort.

This really is a great product.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Opsive UCC and UIS doesnt find the Inventory

Post by Tony Li »

No worries! I'm glad you found the issue. It doesn't hurt to post as soon as you get stuck on something since there may be a known issue or a common solution that will save you time debugging.
Post Reply