bullet hole problem/raycast problem || help me please

hi every one.
For my fps “minigame”, for my bullet hole, I use a script (watch down).

#pragma strict
var timer=3;
var bulletHole: GameObject;
var force=200;


function Start () 
{
	yield WaitForSeconds(timer);
	Destroy(gameObject);
}

function OnCollisionEnter()
{
	Destroy(gameObject);
}

function Update()
{
	var hit : RaycastHit;
	var direction=transform.TransformDirection(Vector3.forward);
	
	if(Physics.Raycast(transform.position,direction,hit,5))
	{
	var tempRot=Quaternion.FromToRotation(Vector3.up,hit.normal);
	var holesBull=Instantiate(bulletHole,hit.point,tempRot);
	}
}

I instance my bullet with a force, and in the bullet prefab there is the script, in the script THERE IS the componente gameObject bulletHole.

when I start the game, the script work perfectly, with the bullet hole and more, BUT, I have this error in the console :

The variable foroSparo of proiettile has not been assigned. You probably need to assign the foroSparo variable of the proiettile script in the inspector.

I don’t now why, becose in the prefab, there is the script with the gameObject reference.

Can you help me please?

Hi Davide,

Though your problem is not very clear to me but from the error you are getting ,the possible solution could be getting reference of gameobject by finding it in start method of script rather than assigning from inspector because Prefabs do not hold the references of the objects present in Hierrachy by directly assigning through inspector.
I hope your problem gets resolved.

Best Regards