我想旋转一个Unity按钮。这是我的代码,但它不起作用。旋转统一按钮
if (GUI.Button(
new Rect(95 * Screen.width/100 - Screen.height/8,
4 * Screen.height/5,
Screen.height/4,
Screen.height/4),
MoreUp) || this.ForceMoreClick)
{
this.transform.rotation.x = 10f;
this.PlayMenuButtonClick();
this.MoreAnimatedDir = this.MoreAnimatedDir == AnimatedDirection.UP
? AnimatedDirection.UPREVERT
: AnimatedDirection.UP;
this.moreAnimation.ChangeAnimatedDirection(this.MoreAnimatedDir);
this.ForceMoreClick = false;
}
我必须为此使用TweenLean吗?
要在Unity的直接模式GUI中旋转单个元素,您需要操作GUI.matrix(RotateAroundPivot旋转整个GUI)(http://docs.unity3d.com/Documentation/ScriptReference/GUI-matrix。如果你真的想经常旋转GUI元素,我建议使用一个所见即所得的GUI工具包,比如NGUI或2D Toolkit,它们有点贵,但是,考虑你的时间值多少钱 – Calvin