Hi Chris,
I am trying to create a kind of grouping for Hotspots, so that I can enable/disable Hotspots in a scene accordingly.
My first thought was using Unity Tags and get all GameObjects with the same tag by using FindGameObjectsWithTag
But then I am stuck on converting GameObject to Hotspot so that I can trigger the TurnOn() command.
Tried
foreach (GameObject myObj in GameObject.FindGameObjectsWithTag(myTag)){hotspot = myObj;}
but got the following error: "Cannot implicitly convert type 'UnityEngine.GameObject' to 'AC.Hotspot' ".
Maybe I am missing something, but is this even possible?
Second try was to put in the Hotspot name a kind of prefix and use the name as a reference, but I couldn't find any function that finds all Hotspots by Name in the Scripting Guide.
Any help would be much appreciated.
Thanks a lot.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Try something like:
that should do the trick
Thanks a lot @HarryOminous, works like a charm!