Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在支持单声道 2.6ish 的 Unity3D 中,对于 gui 元素,我会写这个
SomeProperty = GUI.FloatField(SomeProperty);
但是我想写一些类似的东西
GUI.FloatFieldFor(SomeProperty);
我该怎么做呢?请注意,SomeProperty 是一个浮点数,并且这个 GUI 内容进入一个 OnGUI 方法,该方法在每一帧都被调用,所以我不必滚动我自己的 PropertyChanged 事件。
在 Mono 或 Unity3D 方面没有经验,但您应该能够通过引用传递它。
// Method public void FloatFieldFor(ref float value) { value *= value; // or whatever } // Call method GUI.FloatFieldFor(ref SomeProperty);