no way to compare when less than two revisions
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| — | unity:invokerepeating [2022/04/30 09:13] (현재) – created 192.168.0.1 | ||
|---|---|---|---|
| 줄 1: | 줄 1: | ||
| + | {{tag> invokerepeating }} | ||
| + | ====== | ||
| + | | ||
| + | Description | ||
| + | Invokes the method methodName in time seconds, then repeatedly every repeatRate seconds. | ||
| + | |||
| + | Note : This does not work if you set the time scale to 0. | ||
| + | |||
| + | <file csharp> | ||
| + | using UnityEngine; | ||
| + | using System.Collections.Generic; | ||
| + | |||
| + | // Starting in 2 seconds. | ||
| + | // a projectile will be launched every 0.3 seconds | ||
| + | |||
| + | public class ExampleScript : MonoBehaviour | ||
| + | { | ||
| + | public Rigidbody projectile; | ||
| + | |||
| + | void Start() | ||
| + | { | ||
| + | InvokeRepeating(" | ||
| + | } | ||
| + | |||
| + | void LaunchProjectile() | ||
| + | { | ||
| + | Rigidbody instance = Instantiate(projectile); | ||
| + | |||
| + | instance.velocity = Random.insideUnitSphere * 5; | ||
| + | } | ||
| + | } | ||
| + | </ | ||