When i’m creating gameobjects its like : Cube(clone),Cube(clone),Cube(clone), etc… but i want to be something like Cube1,Cube2,Cube3, etc…
and then: i have attached script “Gravity”
using UnityEngine;
using System.Collections;
public class Gravity : MonoBehaviour {
public Terrain terrain;
public Build check;
public bool placed;
void Start ()
{
check = GameObject.FindWithTag("Player").GetComponent<Build>();
terrain = Terrain.activeTerrain;
}
void Update ()
{
if(check.Active)
{
Ray ray = new Ray(transform.position + Vector3.up * 10000, -Vector3.up);
RaycastHit hit;
if(terrain)
{
if(terrain.collider.Raycast(ray, out hit, Mathf.Infinity))
{
Debug.DrawLine(transform.position, hit.point);
transform.position = hit.point + Vector3.up * 0.5f;
//transform.up = hit.normal;
}
}
}
}
}
(Thanks bigmisterb
)
for each object that i created. I need this to check specific objects that are grounded (could you maybe help me with this too?) and then set this specific object bool “placed” to true.