i do this script but he doesn’t work , he genrate floor in the same place
how can i do , pleaaase help me
using UnityEngine;
using System.Collections;
public class GenerateFloor : MonoBehaviour {
GameObject Floor;
GameObject InstanceFloor;
public GameObject obstacle;
float x;
void Awake()
{
Floor = GameObject.FindGameObjectWithTag("floor");
obstacle = GameObject.FindGameObjectWithTag("plane");
}
void OnCollisionEnter(Collision col)
{
if (col.gameObject.tag == "plane")
{
x = Floor.transform.position.x - 100;
InstanceFloor = (GameObject)Instantiate(Floor, new Vector3(x, 4.2f, -11.6f), Quaternion.identity);
}
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}