beam of light

I have five cube placed in a circular shape i want a beam of light pass from one cube to another automatically to form a circular shape as i am new to unity i do not have idea to do it can any body please help me

You can probably achieve the light beam with the line renderer.

If your cubes are perfectly aligned on a circle, then you can use Mathf.Sin and Mathf.Cos to position the vertices.

Line renderer screenshot

Ok, here’s some script to put in a cube, targetCube being the cube you shoot a line to

 var targetCube : Transform; //drag your targetcube here
 private var vertex0position : Vector3;
 private var vertex1position : Vector3;
 private var counter : int;


 function Start() {
 var lineRenderer : LineRenderer = gameObject.AddComponent(LineRenderer);
 lineRenderer.material = new Material (Shader.Find("Particles/Additive"));
 lineRenderer.SetColors(Color.white,Color.black);
 lineRenderer.SetWidth(0.2,0.2);
 lineRenderer.SetVertexCount(2);
 vertex0position = transform.position; // both vertices start out together, at the cube's transform
 vertex1position = transform.position;
 }

function FixedUpdate() {
        var lineRenderer : LineRenderer = GetComponent(LineRenderer); //need to update the component for movement
        vertex1position = Vector3.Lerp(transform.position,targetCube.position,Time.deltaTime) //lerping vertex 1 first
        lineRenderer.SetPosition(1, vertex1position); // assigning the lerped position to the corresponding vertex
        counter++;
        if(counter>100) //play with this value, will determine when vertex 0 starts following, to get a shooting effect and not a line
         {
         vertex0position = Vector3.Lerp(transform.position,targetCube.position,Time.deltaTime) //lerping vertex 0 
        lineRenderer.SetPosition(0, vertex0position); // assigning the lerped position 
        }
}

Sorry for formatting, in a rush. Code ripped from the docs and adapted for the shooting effect. Needs to be properly implemented in a function, and then just script a relay from cube to cube.

Not the most elegant, but it’s a concrete scripting example of lineRenderer at least!