title: can't get variable from an empty game object with script
body: <p>I'm trying to get variable from an empty gameObject's script, but I can't assign that gameObject on the inspector. These are the screen shots and codes from my game.</p>
  <p>Well, I have this code to load when the game is starting. Land and Prince are objects that made from this code.</p>
  <pre><code>using UnityEngine;
  using System.Collections;
  using System;
  using System.Collections.Generic;
  using System.Runtime.Serialization.Formatters.Binary;
  using System.IO;
  
  
  public class loadGame : MonoBehaviour 
  {
      public static loadGame loadSave;
  
      public GameObject objPrince;
      public Pangeran charPrince;
      public Transform prefPrince;
  
      public Sprite[] spriteTanah;
      public Dictionary&lt;string, Tanah&gt; myTanah = new Dictionary&lt;string, Tanah&gt;();
      public Dictionary&lt;string, GameObject&gt;objTanah = new Dictionary&lt;string, GameObject&gt;();
      public Tanah tempTanah;
      public GameObject tempObjTanah;
      public Transform prefTanah;
      public float mapX;
      public float mapY;
      public int i = 0;
      public int j = 0;
      public int rows = 9;
      public int column = 9;
      
      void Awake(){
          if(loadSave == null)
          {
              DontDestroyOnLoad(gameObject);
              loadSave = this;
          }
          else if(loadSave != this)
              Destroy(gameObject);
  
      }
  
      // Use this for initialization
      void Start () 
      {
          Load ();   
      }
      
      // Update is called once per frame
      void Update () 
      {       
      }
  
      public void Load()
      {
          if(File.Exists(Application.persistentDataPath + &quot;/playerInfo.dat&quot;))
          {
  
          }
          else
          {
              charPrince = new Pangeran (&quot;Prince&quot;, &quot;04Okt1993&quot;, 0, 0, 0, 0, 0, false, false);
              objPrince = GameObject.Instantiate (prefPrince, new Vector3 (0, 0, 0), Quaternion.identity) as GameObject;
              //objPrince.name = &quot;Prince&quot;;
              charPrince.locationY = 0f;
              charPrince.locationX = 0f;
              charPrince.hadapAtas = false;
              charPrince.hadapKanan = true;
              charPrince.stamina = 100f;
              charPrince.exp = 0f;
              charPrince.speed = 0f;
  
              for(i = 0 ; i &lt; rows ; i ++)
              {
                  for(j = 0; j&lt;column ; j++)
                  {
                      mapX = (i-j) * 0.8f;
                      mapY = (i+j) * 0.4f;
  
                      if(i&gt;=1 &amp;&amp; j&gt;=1 &amp;&amp; i&lt;=5 &amp;&amp; j&lt;=5)
                      {
                          prefTanah.name = &quot;land-&quot;+j.ToString(&quot;0#&quot;)+&quot;-&quot;+i.ToString(&quot;0#&quot;);
                          tempTanah = new Tanah(&quot;land-&quot;+j.ToString(&quot;0#&quot;)+&quot;-&quot;+i.ToString(&quot;0#&quot;),mapX,mapY,&quot;land&quot;,spriteTanah[0],spriteTanah[1],spriteTanah[2]);
                          myTanah.Add(&quot;land-&quot;+j.ToString(&quot;0#&quot;)+&quot;-&quot;+i.ToString(&quot;0#&quot;),tempTanah);
                          tempObjTanah = GameObject.Instantiate(prefTanah, new Vector3(mapX,mapY,0),Quaternion.identity)as GameObject;
                          objTanah.Add(&quot;land-&quot;+j.ToString(&quot;0#&quot;)+&quot;-&quot;+i.ToString(&quot;0#&quot;),tempObjTanah);
                      }
                      else
                      {
                          prefTanah.name = &quot;snow-&quot;+j.ToString(&quot;0#&quot;)+&quot;-&quot;+i.ToString(&quot;0#&quot;);
                          tempTanah = new Tanah(&quot;snow-&quot;+j.ToString(&quot;0#&quot;)+&quot;-&quot;+i.ToString(&quot;0#&quot;),mapX,mapY,&quot;snow&quot;);
                          myTanah.Add(&quot;snow-&quot;+j.ToString(&quot;0#&quot;)+&quot;-&quot;+i.ToString(&quot;0#&quot;),tempTanah);
                          tempObjTanah = GameObject.Instantiate(prefTanah, new Vector3(mapX,mapY,0),Quaternion.identity)as GameObject;
                          objTanah.Add(&quot;snow-&quot;+j.ToString(&quot;0#&quot;)+&quot;-&quot;+i.ToString(&quot;0#&quot;),tempObjTanah);
                      }
                  }
              }
  
          }
      }
  }
  </code></pre>
  <p>I'm trying to access one of some variables from code above, but I can't assign it in the inspector.</p>
  <p><img src="https://i.stack.imgur.com/QCFdg.png" alt="I want to assign that code above in this code" /></p>
  <p>but I can't do it.
  <img src="https://i.stack.imgur.com/Z4ugt.png" alt="and this is happened" /></p>
  <p>please help me. Thank you.</p>