public class MapTile : MonoBehaviour {
private string mapName;
public void SetMapName(string t_mapName){
mapName = t_mapName;
}
public string GetMapName(){
return mapName;
}
}
Basically, i have a class like this. I had the string set somewhere else, and expected to be able to get it through the get function, but i couldn’t.
However, when i changed the string from private to public it turned out working. Why is that? I just want to keep this string variable private. Please help!