How to make a model appear by clicking GUI button

I want to make a model appear by clicking a button.

Are you using Unity’s old GUI system or the new UI? If you’re using the new UI, you can use the OnClick() events in the inspector of your button to call functions in script. Inside your script, type something like this:

public void CreateObject(GameObject object) {
Instantiate(object,, Quaternion.Identity);


Then in the inspector under the OnClick() events, press the +. You will also need to fill in the variable for which the script above is on. You can then use the dropdown choice to select your script, then your public function. When you select it, a variable will show to the right allowing you to fill with either a scene object or a prefab from your assets.

If you’re using the old GUI, you could use something like this:

if(GUILayout.Button(...)) {
Instantiate(spawnThisObject,, Quaternion.identity);