我正在尝试使用统一和 Metaio sdk 的 AR 动画。当我尝试下面的脚本时,我必须逐步播放该动画,它在 ipad 和 android 移动设备上完美运行。
Variable declaration
********************
public GUIStyle buttonTextStyle;
public Texture aTexture;
private int curretnStep=1;
GameObject gameObject;
float SizeFactor;
Texture2D texture;
Animator CMTD42M ;
bool isplaystarted = false;
int[] videolengtharray = new int[6];
int CurrentFrame=0;
bool islocked = false;
*************
if (GUIUtilities.ButtonWithText (new Rect (Screen.width - 160, Screen.height - 100, 160, 100), "Next", null, buttonTextStyle)) {
CMTD42M.speed=1;
switch (curretnStep) {
case 1:
CMTD42M.Play ("First");
break;
case 2:
CMTD42M.Play ("Second");
break;
case 3:
CMTD42M.Play ("Third");
break;
case 4:
CMTD42M.Play ("Four");
break;
case 5:
CMTD42M.Play ("Five");
break;
case 6:
CMTD42M.Play ("Six");
break;
}
curretnStep++;
//isplaystarted = true;
}
当我在 Epson Moverio(Glasses) 上运行此脚本时,它不接受按钮单击事件,所以我使用了 onMouseButtonDown 如下脚本:-
if (Input.GetMouseButtonDown (0)) {
if ((new Rect (Screen.width - 160, Screen.height - 100, 160, 100)).Contains (Event.current.mousePosition))
{
CMTD42M.speed=1;
switch (curretnStep) {
case 1:
CMTD42M.Play ("First");
break;
case 2:
CMTD42M.Play ("Second");
break;
case 3:
CMTD42M.Play ("Third");
break;
case 4:
CMTD42M.Play ("Four");
break;
case 5:
CMTD42M.Play ("Five");
break;
case 6:
CMTD42M.Play ("Six");
break;
}
curretnStep++;
}
}
动画没有逐步播放。它以不同的顺序播放..
任何人都可以帮助我,或者请指导我犯错的地方。我是 Unity 和 AR 开发的新手
我得到了正确的鼠标事件。是动画的问题还是鼠标点击的问题..请帮忙..