I have multiple images on the screen. When you click one a border appears with a button to rotate and a button to move the image around the scene. After i select a different image i want to be able to disable the border around the first image and enable it on the next image. I have tried multiple approaches such as
if(Selection.activeGameObject)
{
}
And
if(!Selection.activeGameObject)
{
}
And
if (primaryImage.name != this.gameObject.name)
{
}
So i’ve tried to call OnPointerClick to detect if the image has been clicked. If it has then i went ahead and told it to set this GameObjects border to appear.
public void OnPointerClick (PointerEventData data)
{
if (gameObject.name.Equals("Clone1")
{
_selected = SitkcerPicker.instance.spawn2;
_border2 = GameObject.Find("Clone2/FrameHolder/Border").GetComponentInChildren<Image>();
_border1 = GameObject.Find("Clone1/FrameHolder/Border").GetComponentInChildren<Image>();
_border1.enabled = true;
_border2.enabled = false;
}
}
But this seems a bit barbaric because i have about 75 different variations of images that can be instantiated. While only 5 are able to be instatiated at once. I.e, any one of them can be spawned but up to 5 max in the scene. I havent figured out how to find if another “border” is active. And i cant seem to figure out how to enable a new on while disabling the old one. Ive been on this 10 hours straight and i think im starting to over look the simplest of things.