Create objects with numeration and finding specific objects

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 :wink: )
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.

So where ever you instantiate or create your cube. All you have to do is to keep an index around to keep your number, when you create it, change it’s name as such:

public int index=1;


// just after you create a cube.
cube.name = "Cube" + index;
index++;
cube.AddComponent<Gravity>();

:* :smile:
Thanks, so now all the objects interact with each other is to say, one can move the other and I want to do so, they could not interact with each other.

#Edit i have this Gravity script attached to all of my created cubes and i need to change bool “placed” for one of them, not all but how D: