- Home /
Instantiating a new clone of a prefab whilst setting the previous clone as inactive
I am developing a game where players take turns in spelling a word. I have an input field prefab that is added anytime the player presses a button. Here is what I have done so far: These lines of codes instantiate a new input field when the user clicks the done button
private void ShowInputField(){ %|-504117566_1|% %|-483761895_2|% %|-271517914_3|% %|1945354254_4|% }
Here is code for the done button which calls the ShowInputField function and a NextPlayerTurn function:
public void DoneButton(){ NextPlayerTurn (); ShowInputField (); }
Now what I want to add is when the done button is pressed the previous instantiated clones of the prefab should be set as inactive with the newly added instantiated prefab the only active prefab so that players cannot edit previously entered letters.
Any help would be kindly appreciated. Thank you in advance.