我不明白我爲什麼或者怎樣能夠實例化一個變量並在類的開始處什麼也沒有指定,但是一旦我進入了類的編碼,能夠分配它來使用它。 例如,在團結,我可以:爲什麼我在使用之前實例化
public class MapGenerator : MonoBehaviour {
// right here I can instantiate the variable...
public int width;
public int height;
// and then here I actually use it!!
void GenerateMap() {
map = new int[width,height];
RandomFillMap();
有人可以請清除此爲我?
爲什麼這個標籤'Java'它將給U上的一個錯誤? – Michael
你沒有實例化一個變量,你聲明它。 – rhughes
對不起,使用了錯誤的術語。仍在學習我所能做的一切。 – Letholor