This is a beginner’s question.
I want to press a button in the game and replace the cube with a sphere.
I want to load the sphere when I press the button.
I searched because it was a basic question.
But I don’t know how to find it in the official references.
https://docs.unity3d.com/ja/2019.4/ScriptReference/index.html
Please tell me the search method from the information on the left.
Do you already have as script?
You could attach your GameObjects (Cube and Sphere) to the Script:
public GameObject myCube;
public GameObject mySphere;
void Start()
{
myCube.SetActive(true);
mySphere.SetActive(false);
}
void PressMyButton()
{
myCube.SetActive(false);
mySphere.SetActive(true);
}
Now you attach that Script to the button. How you can do that, you will se in that video:
“SetActive”! Thank you very much. It was very helpful.
1 Like