开发者

x = something(x) as something(x)

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜