【发布时间】:2023-03-23 00:56:02
【问题描述】:
我想做的是:
一些脚本访问:
//...
string Str = "aab";
void Update(){
GUI3D.Label(Str);
GUI3D.TextField(ref Str);
}
//...
在 GUI3D 脚本中:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public static class GUI3D {
static void Label(string Text){
// make text apear
}
static int CursorField;
static void TextField(ref string Text){
// changing cursor field depending on the inputs
// change text and make it apear
}
}
我希望我没有减少太多。 但我想要做的是只有 TextField 可以访问 CursorField 而没有其他人。
如果我想做的话:
static void Label(string Text){
// make text apear
CursorField = 0; // that I'd get error due to protection level.
}
我该怎么做?
【问题讨论】: