I followed the tutorials for 45-interaction-hud
and also for harvesting-items
In my game I only changed the interaction hud to the name (%n) of the interactible object and it works perfectly for the combatants, but...
I would like to give the player also a feedback that he can harvest now (or that he is in front of a tree). The problem here is that the tree has no name (%n). When I write hardcoded "Interact". Then the "interact"-label appears.
Since this is a ORK Scripting thread, I do the creation of a tree prefab by code, which has the event file attached.
I am doing this by
Item item = ORK.Items.data [OrkId];
GameObject itemObject = GameObject.Instantiate(item.prefab) as GameObject;
is this good practice?
or is it also possible to spawn items (like combatants as described in the tutorials) by script? (e.g. for a potion, chest,...)
I tried some things out, but always failed at the end:
- using ItemCollector
- using ItemShortCut (itemCollector.AddItem(..))
- trying to create shortcut with itemGain
always had an Object null reference in
ShortcutHelper.Add(ref this.itemList, shortcut,
maybe someone can give me a code snippet for spawning item collectors by code :)))