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?