Hey, i want to make it so that an empty game object loads a random prefab with the tag “food” so if i make 3 prefabs with the tag food, when the game starts the empty game object will replace itself with a random object from the three objects with the tag food so when the game starts there will always be a random food you get.
I will not write the code for you but I can point your in the right direction.
This is the code you should use for placing a new object in the sceane:
This is the code you should use to find objects with tag:
If you are straggling with specific parts of the code, we can help you, but I don’t think anyone will write the entire code for you.
I wouldnt use prefabs, I would make a list of the objects and randomly choose from that list.
so the variable would be:
var food : GameObject; if I remember correctly
then you should use:
you could also use a variable for those. If you want to know how much objects you have in the list, do this:
that’ s it