我正在Unity中创建一个2D,我有一个加载屏幕,它正在工作(加载动画)。我接下来要做的是让下一个屏幕在一段时间后出现(它是一个游戏对象)。现在,我的代码是:
public RectTransform mainIcon;
public float timeStep;
public float oneStepAngle;
float startTime;
// Start is called before the first frame update
void Start()
{
startTime = Time.time;
}
// Update is called once per frame
void Update()
{
if (Time.time - startTime >= timeStep) {
Vector3 iconAngle = mainIcon.localEulerAngles;
iconAngle.z += oneStepAngle;
mainIcon.localEulerAngles = iconAngle;
startTime = Time.time;
}
}
我现在该怎么办?谢谢
1条答案
按热度按时间ugmeyewa1#
转到播放动画的游戏对象〉创建新脚本并在启动和更新时忽略〉添加此代码
返回到播放动画的对象,然后添加将出现的游戏对象〉转到同一对象上的动画控制器〉选择对象将出现的动画〉添加动画事件〉在检查器中,您应该有this〉选择函数showGameObject