【发布时间】:2016-03-25 21:58:16
【问题描述】:
我不知道我做错了什么,我想通过 get 访问器访问私有整数,但我无法让它工作。 Map 类编译得很好,但我无法从 MapViewer 中的一个实例访问 get 方法。
我也尝试在官方文档中阅读它,代码应该没问题,但它不是
谢谢!
public class Map {
int xSize {get;} = 0;
int ySize {get;} = 0;
public Map(int xSize, int ySize){
this.xSize = xSize;
this.ySize = ySize;
}
}
public class MapViewer : MonoBehaviour {
int xSize = 20;
int ySize = 20;
Map map;
Texture2D image;
void Start () {
map = new Map (xSize, ySize);
image = new Texture2D(map.???, map.???); //The issue is here
}
【问题讨论】: