hi, thank you so much for your support, but i feel im doing something fundamentaly wrong since my progress is stagnating since a week and i have tried to set it up multiple times (just copy the demo screen and build everything there, feel i generated to much technical debt, so i tried to set it up from scrach with the ui designer).
this may be lack of my programming skills but i realy dont seem to get simple things running even with your tutorials.
basicallay all i want to set up is a menu screen with an inventory and equipment which is different depending on whom i click,
this is the progress i got running so far:
im generating prefabs of my models at runtime and add to them via put the model in the right spot, PlayerUnit is the model prefab:
where IC is just a id "eq" and the purpous is equipment
now when i select a go unit, i call this
and i like to add an item while runtime, which i do like this (database is from the demo):
now when i open the Equipment and inventory tab i get alot of errors and i dont understand why
now the vast ammount of errors i get are:
which is directing me to this line of code:
which IS a instance since i am instanticating it!
then when i select the unit game object i get this error:
now i tried to add as stated above IC is just equipable, and it dosent recognize it (why?)
i would realy be thankfull for any help, and i do understand that giving hints in the right direction helps learning, but im suck since a week now, and i dont see why this should be so complicated and unintuitive even though i have done the "tutorial" as in the videos,
so i would realy be thankfull for a simple line of code since this seems to be the issue,
* where i can create units at runtime (with that i mean adding an inventory and equipment slots which i can equip and unequip for each unit distinct, so that unit A und unit B have their own equipment and inventory)
where i can create items which do not give errors at runtime, (where i can assing an item in to the inventory)
and a inventory and equipment menu which works! at runtime!
i hope this dosent sound like a rant, but im kinda frustrated that im taking one week to get this running, and i feel this setup stuf should not take longer than an hour
thank you very much in advance!
this may be lack of my programming skills but i realy dont seem to get simple things running even with your tutorials.
basicallay all i want to set up is a menu screen with an inventory and equipment which is different depending on whom i click,
this is the progress i got running so far:
im generating prefabs of my models at runtime and add to them via put the model in the right spot, PlayerUnit is the model prefab:
Code:
GoList.Add(Instantiate(PlayerUnit, playerSpawn.transform.GetChild(GoList.Count).GetChild(0).transform));
// go is GoList[GoList.Count - 1]
go.AddComponent<Inventory>();
go.GetComponent<Inventory>().AddItemCollection(IC);
where IC is just a id "eq" and the purpous is equipment
now when i select a go unit, i call this
Code:
Inventory.GetComponent<ItemViewSlotsContainerPanelBinding>().BindInventory(go.GetComponent<Inventory>());
Menu.GetComponent<DisplayPanelManager>().OpenPanel("Box Panel");
// set equip to corect inventory
Equip.GetComponent<ItemViewSlotsContainerPanelBinding>().BindInventory(go.GetComponent<Inventory>());
Menu.GetComponent<DisplayPanelManager>().OpenPanel("Equipment Panel");
and i like to add an item while runtime, which i do like this (database is from the demo):
Code:
//list of items i create
SpawnedItems.Add(InventorySystemManager.CreateItem("Iron Sword"));
// add to last go unit which i have collected in GoList
GoList[GoList.Count - 1].GetComponent<Inventory>().AddItem(new ItemInfo((1, SpawnedItems[SpawnedItems.Count - 1])));
now when i open the Equipment and inventory tab i get alot of errors and i dont understand why
now the vast ammount of errors i get are:
"NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateInventorySystem.UI.Item.ItemViewSlotsContainer.Initialize (System.Boolean force) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/ItemViewSlotsContainer.cs:39)"
which is directing me to this line of code:
Code:
UnitList.Add(Instantiate(PlayerUnit, playeSpawn.transform.GetChild(UnitList.Count).GetChild(0).transform));
which IS a instance since i am instanticating it!
then when i select the unit game object i get this error:
The inventory 'Prefab HeroUnit(Clone) (Opsive.UltimateInventorySystem.Core.InventoryCollections.Inventory)' does not contain an item slot collection for the ID provided in the ItemSlotCollectionView
now i tried to add as stated above IC is just equipable, and it dosent recognize it (why?)
i would realy be thankfull for any help, and i do understand that giving hints in the right direction helps learning, but im suck since a week now, and i dont see why this should be so complicated and unintuitive even though i have done the "tutorial" as in the videos,
so i would realy be thankfull for a simple line of code since this seems to be the issue,
* where i can create units at runtime (with that i mean adding an inventory and equipment slots which i can equip and unequip for each unit distinct, so that unit A und unit B have their own equipment and inventory)
where i can create items which do not give errors at runtime, (where i can assing an item in to the inventory)
and a inventory and equipment menu which works! at runtime!
i hope this dosent sound like a rant, but im kinda frustrated that im taking one week to get this running, and i feel this setup stuf should not take longer than an hour
thank you very much in advance!
Last edited: