Hey guys,
Quick question: I’ve designed something like a World of Warcraft-styled hotbar for my game. The way it works is that it’s just 10 planes that should show the texture of the item that’s put in that slot.
So the way I set this up is that I have a ‘refreshTextures’ function that just goes through stuff like:
if(item == “Potion”){
renderer.material.mainTexture = GameObject.Find(“inventory”).GetComponent(inventory).Potion;}
Now, all of this works just nicely. The problem is that I have 10 planes and the that function has to be called 10 times (for each plane). So what I want to do is:
If Player picks up Item, assign texture to hotbar slot(I already set that up) and then refresh all the hotbar textures.
Every single hotbar slot should receive the ‘refreshTextures’ message from the pickup, but every time I do it only the LAST hotbarSlot with the name, tag, variable, etc. actually changes its texture.
Isn’t there a simple, non-convoluted way of sending out a message to MULTIPLE objects that then call a function at the same time?