Text to IItemIdentifier

muhammadasif527

New member
inventory.Pickup function requires IItemIdentifier while i have string as input. How i can convert Text to IItemIdentifier.
I have Text because i could not save IItemIdentifier in Json file.
 
There isn't a built in way so you will need to create your own mapping. Item Identifiers can have the same name so you will need to ensure that the name does not overlap within your own solution. As a starting point you could create a dictionary that loops through the item collection and saves the mapping.
 
You can get all of the possible item identifiers from the ItemCollection. The ItemCollection contains an array of item types which are also item identifiers.
 
It's hard to say without stepping through the code but the bottom of this page gives an example of equipping an item:

 
i had made pikup prefabs for all inventory.
how i can call this prefab (which function i should call) via code to be acted like it is pickuped by player.
 
I'm not following - you don't call the prefab directly. The prefab is instantiated based on what is specified within the Item Type.
 
Ah, you can call Inventory.PickupItem. Take a look at the ItemPickup script for an example.
 
Top