(unity)一定間隔で繰り返し向いている方向に火の玉を発射する(InvokeRepeating)

(スクリプト)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ShotFireBall : MonoBehaviour
{
    public GameObject fireBallPrefab;

    void Start()
    {
        InvokeRepeating("ShotFire", 1, 2);
    }

    void ShotFire()
    {
        Instantiate(fireBallPrefab, transform.position, transform.root.rotation);
    }
}

(実行結果)