Destroying GameObjects With Different Names?

Hello, just wondering if some1 could help me im current developing a voxel based game and im in the middle of creating lanterns, an so what im trying to do is once i have placed my block im instantiating a Light and then renaming it such as Light#0, Light#1, Light#2 and so on and this brings me to my question im having trouble with after its been renamed so its no longer Light(Clone) once i destroy the block i want the light to be destroyed also some how but im not exactly sure how to go about Getting the exact Light as you can probably tell, i did try useing RayCasts but they just hit the block and not the light source… … :l - any help is greatly appreshiated & sorry if my code is a little all over the place im semi new to C#…
P.S: Dont think my code below is Functional it will most likely have errors i left it As is just so if anyone can help they have a better understanding of Exactly what my issues is and kinda what i want my outcome to be just incase i didnt explain it well enough.

using UnityEngine;
using System.Collections;

public class TorchID : MonoBehaviour {

    private int i;
    public Transform RedLight;

    public void OnTorchPlace ()
    {
        Debug.Log ("Lantern has been Placed");
            var t = GameObject.Find ("RedLight(Clone)");
            t.name = "LightSource#" + i;
            i++;
    }

    public void torchDestroyed()
    {
        Debug.Log ("Lantern has been Destroyed");
        Destroy (GameObject.Find ( transform.LookAt(RedLight)));
    }
}

how are you instantiating the torches? if they are a child of the block you could give the block an “OnDestroy()” function which destroys any children. Then it doesn’t matter what they are called, the block knows what transforms are it’s children and destroys them.

Hey thanks for Replying - That would work although the Block and the lights unfortunately are different objects and arnt children of the Torches because the way the voxel engine is build on blocks being placed they dont show in the hierarchy im not exactly 100% on how it all works but the lights arnt anything to do with the torches they are a seperate Object that im instantiating within the block once it has been place

oh, you’re using a third party voxel engine? which one?

Uniblocks :slight_smile: its been pretty good so far would be evan better if i could figure out how to fix my problem tho haha its been bugging me for about a week only just got the ergy to be botherd to make a thread :stuck_out_tongue: