Hello Everyone, I have a script that I’m trying to make so it changes the someGameObject into switchOut. Everything’s working fine except when I click the change button someGameObject doesn’t change into switchOut but makes someGameObject equal to switchOut. How do I get it so it changes someGameObject and not change what it equals?
using UnityEngine;
using System.Collections;
public class SomeScript : MonoBehaviour {
public string[] someStringArray;
public string someString;
public GameObject switchOut;
public GameObject someGameObject;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void OnGUI () {
if(GUILayout.Button("Change", GUILayout.Width(75), GUILayout.Height(25))){
someGameObject = switchOut;
}
}
}