instantiate object and get component box collider

Hello,

how to get component with intantiate object?

my code

test = final.GetComponent<BoxCollider>();
                    final = Instantiate (pointray.temp, point, Quaternion.identity);

this code not work why ?

sorry isn’t here

Code reads from the top down, in the case of what you provided, you first attempt to get the component of an object called final which does not exist yet, then you created it. You must first create the game object and then try to get the instances component.

var final = Instantiate (pointray.temp, point, Quaternion.identity);
test = final.GetComponent<BoxCollider>();