just like i said in the question. I have a game object im trying to track in a script, i declared a public variable with the intention of dragging and dropping the game object into the script that was attached to a prefab - but it didn’t allow me to assign it. Then i put the prefab in the scene and again tried to assign the variable. This time it let me drag the object in, however it wouldnt let me apply changes. Heres the script
using UnityEngine;
using System.Collections;
public class Planet : MonoBehaviour {
public float size;
public float speed;
public float speedMin;
public float speedMax;
public Vector3 position;
public double mass;
public GameObject pivot;
public GameObject planetMenuRoot;
void Start()
{
speed = Random.Range(speedMin, speedMax);
}
void OnTriggerEnter()
{
Debug.Log ("planet entered");
planetMenuRoot.SetActive(true);
AstraeusFlight.inPlanet = true;
AstraeusFlight.planet = gameObject.transform;
}
void Update()
{
transform.RotateAround(Vector3.zero, Vector3.up, speed * Time.deltaTime);
}
}
the variable im attempting to assign is the planetMenuRoot which is an empty game object inside of an NGUI panel. I have also tried spawning a cube and an empty game object and attaching those to the script on the prefab - no luck. anyone know whats going on?