I'm having this problem in Unity when trying to initialize a few variables. I have an example below.
public class PlanetDetails
{
private int planetID;
private string planetName;
public int PlanetID
{
get { return planetID; }
set { planetID = value; }
}
public string PlanetName
{
get { return planetName; }
set { planetName = value; }
}
}
PlanetDetails[] Planet = new PlanetDetails[10];
...
Planet.PlanetID = (System.SystemID + Random.Range(0, 1000));
Planet.PlanetName = "Test" + i;
Debug.Log(Planet.PlanetID);
Debug.Log(Planet.PlanetName);
When I try to initialize a variable, it gives me an error in Unity, and since I'm pretty new to programming, I can't understand why. Any help would be great.