I am trying to set a variable in a class that I created.
public class Star
{
public int starID { get; set; }
public Vector3 position { get; set; }
public string starName { get; set; }
public char starClass { get; set; }
}
Later, in the same file I tried the following code:
public void generateGalaxy()
{
for(int i = 0; i < numOfStars; i++)
{
spawnStar();
}
}
public void spawnStar()
{
Star testStar = new Star();
testStar.starName.set("star1");
}
The error was on '.set', the message was:
'string' does not contain a definition for 'set' and no extension method 'set' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?
Any ideas?