0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Prefabを一定間隔でランダムな場所に生成

Posted at

HDRPでも動くこと確認済み。
蝶々の.vfxで試したのでバタフライメイカーという名前になってます
もう少し使いやすく改良します、いずれ

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

public class ButterFliesMaker : MonoBehaviour
{

    public GameObject butterFliesPrefab;
    float span = 1.0f;
    float delta = 0;

    void Update()
    {
        this.delta += Time.deltaTime;
        if(this.delta > this.span)
        {
            this.delta = 0;
            GameObject birth = Instantiate(butterFliesPrefab);
            int px = Random.Range(-7, 6);
            birth.transform.position = new Vector3(px, 5.0f,0.0f);
        }
    }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?