In Unity3D, which supports mono 2.6ish, for a gui element, I'd write this
SomeProperty = GUI.FloatField(SomeProperty);
However I would like to write something like
GUI.FloatFieldFor(SomeProperty);
How would I go about doing this? Note that SomeProperty is a float, and this GUI stuff goes in an OnGUI method which is called every frame, so I don't have to roll my own PropertyChanged event.
Not experienced in Mono or Unity3D, but you should be able to pass it by reference.
// Method
public void FloatFieldFor(ref float value)
{
value *= value; // or whatever
}
// Call method
GUI.FloatFieldFor(ref SomeProperty);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.