Hello everyone! I would like for multiple objects tags to be changed when I click a separate object. For some reason it won’t work
#pragma strict
function OnMouseUp () {
var weapon = GameObject.FindGameObjectsWithTag ("Unequiped");
renderer.enabled = true;
}
It won’t work because you didn’t even try to change the tags. All you did is set the weapon variable to a list of GameObjects that have the tag “Unequiped”. In order to then change the tags for all these unequiped, add a loop. Since you are using JS, I will provide an answer in JS. For the loop, you should use…
for(var wep : GameObject in weapon){
wep.tag = "TAG YOU WANT TO SET TO";
}
If you cannot understand what I wrote, I suggest going into tutorials about programming and loops.