相关疑难解决方法(0)

随着时间的推移移动GameObject

我正在从Swift SpriteKit背景学习Unity,其中移动精灵的x位置与运行动作一样直接如下:

let moveLeft = SKAction.moveToX(self.frame.width/5, duration: 1.0)
let delayAction = SKAction.waitForDuration(1.0)
let handSequence = SKAction.sequence([delayAction, moveLeft])
sprite.runAction(handSequence)
Run Code Online (Sandbox Code Playgroud)

我想知道一种等效或类似的方法,将精灵移动到特定持续时间(例如,一秒)的特定位置,并且延迟不必在更新函数中调用.

c# unity-game-engine unity5

8
推荐指数
1
解决办法
5238
查看次数

随着时间的推移增加和减少光强度

我想在 Unity 中创建一些萤火虫。我想增加光强度,然后等待几秒钟,然后在 Unity 中减少它。当它们生成时,我希望它们增加光强度,等待几秒钟,然后淡出。我怎样才能以干净的方式创建这个“过程”?

private Light pointLight; // The light component of the firefly

private float minLuminosity = 0; // min intensity
private float maxLuminosity = 1; // max intensity

private float luminositySteps = 0.005f; // factor when increasing / decreasing

private float shineDuration = 3; // wait 3 seconds when faded in

private void Start()
{
    pointLight = GetComponent<Light>();
    pointLight.intensity = Random.Range(minLuminosity, maxLuminosity); // start with a random intensity
    StartCoroutine(ChangeIntensity()); // start the process
}

private IEnumerator ChangeIntensity() …
Run Code Online (Sandbox Code Playgroud)

c# unity-game-engine

2
推荐指数
1
解决办法
5908
查看次数

如何在Unity中显示类似于Android中的Toast消息?

Unity中是否有类似Toast的消息,类似于GUI,而与android类似。在android中,只需一行代码就很容易。

public void buttonclick()
{
// Message to show
}
Run Code Online (Sandbox Code Playgroud)

c# unity-game-engine

1
推荐指数
2
解决办法
5071
查看次数

标签 统计

c# ×3

unity-game-engine ×3

unity5 ×1