1

我正在统一 3d 中做一个迷你游戏,其中我有门动画,我在检查器中创建了门精灵,现在我的问题是当我单击需要打开的门时,我使用了 object Instantiate 方法,[players = (GameObject ) Instantiate(playerPrefab, new_size, Quaternion.identity);] 但我认为这不是一个合适的方法,因为它会创建门的重复副本,这就是为什么,如果有任何其他想法请回复

4

1 回答 1

1

您需要将纹理存储为类中的变量。然后你应该调用一个方法(例如一个 IEnumerator 或者你可以在 Update() 中使用 if 语句)然后将来自wiki.unity3d.com 的 SPrite Animation的代码插入你的 Class(class.cs)。

或者您可以在Sprite Animation中的 Update 方法中插入 if 语句,并在您要调用动画时将其设置为 true。

于 2012-11-08T22:49:07.310 回答