Bullet Hole Script

This is my bullet hole script so far. Does anyone know whats wrong with it? The error im getting is: unknown identifier “Instanciate”

var maxDist : float = 1000000000;
var decalHitWall : GameObject;
var floatInFrontOfWall : float = 0.00001;

function Update () 
{
	var hit : RaycastHit;
	if (Physics.Raycast(transform.position, transform.forward, hit, maxDist))
	{
		if(decalHitWall  hit.transform.tag == "Level Parts")
			Instanciate(decalHitWall, hit.point + (hit.normal * floatInFrontOfWall), Quaternion.LookRotation(hit.normal));
	}
	
}

Instantiate. Spelling error.

thanks

var maxDist: float = 1000000000;
var decalHitWall : GameObject;
var floatInFrontOfWall : float = 0.00001;

function Update ()
{

var hit : RaycastHit;

if(Physics.Raycast(transform.position,transform.forward, hit,maxDist))
{
if(decalHitWall && hit.transform.tag == “Level Parts”)

Instantiate(decalHitWall, hit.point + (hit.normal * floatInFrontOfWall), Quaternion.LookRotaion(hit.normal));
}
}

This is the version of C# code for everyone who was looking for it, its the same but only translated to c-sharp, hope is usefull

using UnityEngine;
using System.Collections;

public class BulletHoleScript : MonoBehaviour {

    public float maxDist = 1000000000f;
    public GameObject decalHitWall;
    float floatInFrontOfWall = 0.00001f;

    void Update ()
    {
        RaycastHit hit;
        if (Physics.Raycast(transform.position, transform.forward, out hit, maxDist))
        {
            if(decalHitWall && hit.transform.tag == "Level Parts")
            Instantiate(decalHitWall, hit.point + (hit.normal * floatInFrontOfWall), Quaternion.LookRotation(hit.normal));
        }
    }
}
3 Likes