#look in the thread
1 messages · Page 1 of 1 (latest)
so
before
in the hot bar manager i was calling UpdateSelectedSlot
and that was running before the slot even had an item
so now when i added the awake
it works because the item is first set and then the method in hotbar manager is called
so before it was like this
the slots item was getting set after the method in the start here
and now that i also put it in awake
the item in the slot is getting set first
right so it should be going in Start not Awake
CheckForItem
since it depends on another object being intiailized (the slot)
how
how what?
wait sorry I'm getting confused between CheckForItem and UpdateSelectedItem
CheckForItem() just checks if the slot has an item
HandleSlotSwitching() checks if you have an item in the current hotbar slot you are on and equips it
honestly rather than bothering with this I would just run CheckForItem lazily whenever the item is accessed
in a property getter
rather than putting it in Awake/Update/etc
how?
also this is my inventory script
and when i pickup the item
it gets added to the inventory
and then i call the UpdateSelectedSlot() method from hotbar manager
but it doesnt do anything
because the method gets called before the slot even has a chance to set item to the item it currently has
what do i do?
@latent meteor
this^
how do i do that?