1. 程式人生 > >Unity在地圖範圍內任意位置隨機生成3D模型

Unity在地圖範圍內任意位置隨機生成3D模型

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


public class GameController : MonoBehaviour {
    public GameObject tank;
    float timer = 0;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
        timer += Time.deltaTime;
        if (timer >= 5)
        {
            timer = 0;
            Instantiate(model, new Vector3(Random.Range(-11f, 60f),95,Random.Range(-10f,65f)),Quaternion.identity);
        }
}
}