NullReferenceException: Object reference not set to an instance of an object Level2Script.Start () (at Level2Script.cs:15

0

public class Level2Script : MonoBehaviour
{
    public List<Text> Buttons;
    public List<string> Services;
    public List<string> Characteristics;

    // Use this for initialization
    void Start ()
   {
    int buttonID = 0;

     foreach (var device in FoundDeviceListScript.DeviceAddressList)   // bu kısım için hata veriyor .  15. satır...
        {
            Buttons[buttonID++].text = device.Name;
            if (buttonID == 4)
                break;
        }
    }

...

-FoundDeviceListScript- 


public class FoundDeviceListScript : MonoBehaviour
{
    static public List<DeviceObject> DeviceAddressList;

    // Use this for initialization
    void Start ()
    {
        DontDestroyOnLoad (gameObject);
    }
}


-DeviceObjectScript-

public class DeviceObject
{
    public string Address;
    public string Name;

    public DeviceObject ()
    {
        Address = "";
        Name = "";
    }

    public DeviceObject (string address, string name)
    {
        Address = address;
        Name = name;
    }
}

ylcn ylcn (3)
7 yıl önce sordu

    Toplam 1 Cevap


    0

    FoundDeviceListScript nesneniz null. Bu sebepten hata alıyorsunuz.

    murat murat (12492)
    7 yıl önce cevaplandı

      üyelik gerektirir

      Cevap yazabilmek için üye girişi yapmalısınız.

      Eğer uzmanim.net üyesiyseniz giriş yapabilirsiniz: üye girişi yap
      uzmanim.net'e üye olmak çok kolaydır: hemen kayıt ol