I can drag a prefab to the empty gameobject slot in inspector fine, but once I hit play the connection is lost.
My editor script looks like this
[CustomEditor(typeof(IglooCameraController))]
[CanEditMultipleObjects]
public class IglooCameraControllerEditor : Editor {
IglooCameraController cameraObject;
public void OnEnable(){
cameraObject= (IglooCameraController)GameObject.FindObjectOfType(typeof(IglooCameraController));
}
public override void OnInspectorGUI(){
serializedObject.Update();
cameraObject.cameraPrefab= EditorGUILayout.ObjectField("Camera Prefab",cameraObject.cameraPrefab, typeof(GameObject),true) as GameObject;
cameraObject.setVlaues ();
}
}
And the IglooCameraController looks like this (I’ve taken all irrelevant code out)
public class IglooCameraController : MonoBehaviour {
public GameObject cameraPrefab;
}