hi everyone~ i have an array of prefabs with the ‘Options’ tag which will immediately be called when it is instantiated on the screen (picture below shows how it looks like in the hierarchy).
the second cloned option is set to default as the first option that appears on the screen, but the first cloned option’s placement is hiding behind the second clone. what i want to do is deactivate the second cloned option when the player presses the left arrow button and reactivate it again when the player presses the right button (sort of like scrolling back and forth between options). do i need to do it in an array of sorts?
the script below is what i have so far, it detects the instantiated clone options and has the input (but now all thats left is deactivating/activating certain prefabs).
private void Update()
{
optionViewPrefabs = GameObject.FindGameObjectsWithTag("Options");
foreach(GameObject _optionViewPrefabs in optionViewPrefabs)
{
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
Debug.Log("Hi");
_optionViewPrefabs.setActive(false);
}
else if (Input.GetKeyDown(KeyCode.RightArrow))
{
Debug.Log("K");
//
}
}
}