Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Why doesn´t work?

$
0
0
Hi, I have a problem with this code, I'm a student, so, maybe it´s so simple, I don't now, I try maker simply, this is an example of my error: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Example : MonoBehaviour { public struct StringContainer { public string value; public void SetValue(string otherValue) { value = otherValue; } } void Method() { List stringContainers = new List(); stringContainers.Add(new StringContainer()); stringContainers[0].SetValue("gato"); Debug.Log (stringContainers [0].value.Length); } // Use this for initialization void Start () { Method (); } // Update is called once per frame void Update () { } } the error is " Object reference not set to an instance of an object" I don´t really understand

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>