Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

MonoBehaviour.InvokeRepeating

マニュアルに切り替える
public void InvokeRepeating(string methodName, float time, float repeatRate);

パラメーター

説明

設定した時間(単位は秒)にメソッドを呼び出し、repeatRate 秒ごとにリピートします

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Rigidbody projectile; void LaunchProjectile() { Rigidbody instance = Instantiate(projectile); instance.velocity = Random.insideUnitSphere * 5; } void Example() { InvokeRepeating("LaunchProjectile", 2, 0.3F); } }