Failed to call function Hit of class TrainingDummy

  1. List item

"Failed to call function Hit class trainingDummy Calling function hit with 1 parameter but the function requires 2."

I get this error when ever I shoot the enemy with the traning dummy script on it. What does it mean?

heres the gun script where the errors appear on lines 346, 203, and 456 which are under the functions CheckRaycast, ShotTheTarget, and Update:

enum FireType
{
    RAYCAST,
    PHYSIC_PROJECTILE,
}

enum FireMode
{
    SEMI_AUTO,
    FULL_AUTO,
    BURST
}

class Gun extends MonoBehaviour
{
    public var gunName : String;
    public var bulletMark : GameObject;
    public var projectilePrefab : GameObject;

    public var weaponTransformReference : Transform;

    public var hitLayer : LayerMask;

    public var woodParticle : GameObject;
    public var metalParticle : GameObject;
    public var concreteParticle : GameObject;
    public var sandParticle : GameObject;
    public var waterParticle : GameObject;

    //How many shots the gun can take in one second
    public var fireRate : float;
    public var useGravity : boolean;
    private var fireType : FireType;
    public var fireMode : FireMode;

    //Number of shoots to fire when on burst mode
    public var burstRate : int;

    //Range of fire in meters
    public var fireRange : float;

    //Speed of the projectile in m/s
    public var projectileSpeed : float;

    public var clipSize : int;
    public var totalClips : int;

    //Time to reload the weapon in seconds
    public var reloadTime : float;
    public var autoReload : boolean;
    public var currentRounds : int;

    public var shootVolume : float = 0.4;
    public var shootSound : AudioClip;
    private var shootSoundSource : AudioSource;

    public var reloadSound : AudioClip;
    private var reloadSoundSource : AudioSource;

    public var outOfAmmoSound : AudioClip;
    private var outOfAmmoSoundSource : AudioSource;

    private var reloadTimer : float;

    @HideInInspector
    public var freeToShoot : boolean;

    @HideInInspector
    public var reloading : boolean;
    private var lastShootTime : float;
    private var shootDelay : float;
    private var cBurst : int;

    @HideInInspector
    public var fire : boolean;
    public var hitParticles : GameObject;

    public var shotingEmitter : GunParticles;
    private var shottingParticles : Transform;

    public var capsuleEmitter : ParticleEmitter[];

    public var shotLight : ShotLight;

    public var unlimited : boolean = true;

    private var timerToCreateDecal : float;

    public var pushPower : float = 3.0;

    public var soldierCamera : SoldierCamera;
    private var cam : Camera;

    function OnDisable()
    {
        if(shotingEmitter != null)
        {
            shotingEmitter.ChangeState(false);
        }

        if(capsuleEmitter != null)
        {
            for(var i : int = 0; i < capsuleEmitter.Length; i++)
            {
                if (capsuleEmitter *!= null)*
 _capsuleEmitter*.emit = false;*_
 _*}*_
 _*}*_
 _*if(shotLight != null)*_
 _*{*_
 _*shotLight.enabled = false;*_
 _*}*_
 _*}*_
 _*function OnEnable()*_
 _*{*_
 _*cam = soldierCamera.camera;*_
 _*reloadTimer = 0.0;*_
 _*reloading = false;*_
 _*freeToShoot = true;*_
 _*shootDelay = 1.0 / fireRate;*_
 _*cBurst = burstRate;*_
 _*totalClips--;*_
 _*currentRounds = clipSize;*_
 _*if(projectilePrefab != null)*_
 _*{*_
 <em>*fireType = FireType.PHYSIC_PROJECTILE;*</em>
 _*}*_
 _*if(shotLight != null)*_
 _*{*_
 _*shotLight.enabled = false;*_
 _*}*_
 _*shottingParticles = null;*_
 _*if(shotingEmitter != null)*_
 _*{*_
 _*for(var i : int = 0; i < shotingEmitter.transform.childCount; i++)*_
 _*{*_
 <em>*if(shotingEmitter.transform.GetChild(i).name == "bullet_trace")*</em>
 _*{*_
 _*shottingParticles = shotingEmitter.transform.GetChild(i);*_
 _*break;*_
 _*}*_
 _*}*_
 _*}*_
 _*}*_
 _*function ShotTheTarget()*_
 _*{*_
 _*if(fire && !reloading)*_
 _*{*_
 _*if(currentRounds > 0)*_
 _*{*_
 _*if(Time.time > lastShootTime && freeToShoot && cBurst > 0)*_
 _*{*_
 _*lastShootTime = Time.time + shootDelay;*_
 _*switch(fireMode)*_
 _*{*_
 <em>*case FireMode.SEMI_AUTO:*</em>
 _*freeToShoot = false;*_
 _*break;*_
 _*case FireMode.BURST:*_
 _*cBurst--;*_
 _*break;*_
 _*}*_
 _*if(capsuleEmitter != null)*_
 _*{*_
 _*for(var i : int = 0; i < capsuleEmitter.Length; i++)*_
 _*{*_
 <em>_capsuleEmitter*.Emit();*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*PlayShootSound();*_</em>
 <em>_*if(shotingEmitter != null)*_</em>
 <em>_*{*_</em>
 <em>_*shotingEmitter.ChangeState(true);*_</em>
 <em>_*}*_</em>
 <em>_*if(shotLight != null)*_</em>
 <em>_*{*_</em>
 <em>_*shotLight.enabled = true;*_</em>
 <em>_*}*_</em>
 <em>_*switch(fireType)*_</em>
 <em>_*{*_</em>
 <em>_*case FireType.RAYCAST:*_</em>
 <em>_*TrainingStatistics.shootsFired++;*_</em>
 <em>_*CheckRaycastHit();*_</em>
 <em>_*break;*_</em>
 <em><em>*case FireType.PHYSIC_PROJECTILE:*</em></em>
 <em>_*TrainingStatistics.grenadeFired++;*_</em>
 <em>_*LaunchProjectile();*_</em>
 <em>_*break;*_</em>
 <em>_*}*_</em>
 <em>_*currentRounds--;*_</em>
 <em>_*if(currentRounds <= 0)*_</em>
 <em>_*{*_</em>
 <em>_*Reload();*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*else if(autoReload && freeToShoot)*_</em>
 <em>_*{*_</em>
 <em>_*if(shotingEmitter != null)*_</em>
 <em>_*{*_</em>
 <em>_*shotingEmitter.ChangeState(false);*_</em>
 <em>_*}*_</em>
 <em>_*if(shotLight != null)*_</em>
 <em>_*{*_</em>
 <em>_*shotLight.enabled = false;*_</em>
 <em>_*}*_</em>
 <em>_*if(!reloading)*_</em>
 <em>_*{*_</em>
 <em>_*Reload();*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*else*_</em>
 <em>_*{*_</em>
 <em>_*if(shotingEmitter != null)*_</em>
 <em>_*{*_</em>
 <em>_*shotingEmitter.ChangeState(false);*_</em>
 <em>_*}*_</em>
 <em>_*if(shotLight != null)*_</em>
 <em>_*{*_</em>
 <em>_*shotLight.enabled = false;*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*function LaunchProjectile()*_</em>
 <em>_*{*_</em>
 <em>_*//Get the launch position (weapon related)*_</em>
 <em><em>_var camRay : Ray = cam.ScreenPointToRay(new Vector3(Screen.width * 0.5, Screen.height * 0.6, 0));_</em></em>
 <em>_*var startPosition : Vector3;*_</em>
 <em>_*if(weaponTransformReference != null)*_</em>
 <em>_*{*_</em>
 <em>_*startPosition = weaponTransformReference.position;*_</em>
 <em>_*}*_</em>
 <em>_*else*_</em>
 <em>_*{*_</em>
 <em><em>_startPosition = cam.ScreenToWorldPoint(new Vector3 (Screen.width * 0.5, Screen.height * 0.5, 0.5));_</em></em>
 <em>_*}*_</em>
 <em>_*var projectile : GameObject = GameObject.Instantiate(projectilePrefab, startPosition, Quaternion.identity);*_</em>
 <em>_*var grenadeObj : Grenade = projectile.GetComponent("Grenade") as Grenade;*_</em>
 <em>_*grenadeObj.soldierCamera = soldierCamera;*_</em>
 <em>_*projectile.transform.rotation = Quaternion.LookRotation(camRay.direction);*_</em>
 <em>_*var projectileRigidbody : Rigidbody = projectile.rigidbody;*_</em>
 <em>_*if(projectile.rigidbody == null)*_</em>
 <em>_*{*_</em>
 <em>_*projectileRigidbody = projectile.AddComponent("Rigidbody");*_</em> 
 <em>_*}*_</em>
 <em>_*projectileRigidbody.useGravity = useGravity;*_</em>
 <em>_*var hit : RaycastHit;*_</em>
 <em><em>_var camRay2 : Ray = cam.ScreenPointToRay(new Vector3(Screen.width * 0.5, Screen.height * 0.55, 0));_</em></em>
 <em>_*if(Physics.Raycast(camRay2.origin, camRay2.direction, hit, fireRange, hitLayer))*_</em>
 <em>_*{*_</em>
 <em><em>_projectileRigidbody.velocity = (hit.point - weaponTransformReference.position).normalized * projectileSpeed;_</em></em>
 <em>_*}*_</em>
 <em>_*else*_</em>
 <em>_*{*_</em>
 <em><em>_projectileRigidbody.velocity = (cam.ScreenToWorldPoint(new Vector3(Screen.width * 0.5, Screen.height * 0.55, 40)) - weaponTransformReference.position).normalized * projectileSpeed;_</em></em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*function CheckRaycastHit()*_</em>
 <em>_*{*_</em>
 <em>_*var hit : RaycastHit;*_</em>
 <em>_*var glassHit : RaycastHit;*_</em>
 <em>_*var camRay : Ray;*_</em>
 <em>_*var origin : Vector3;*_</em>
 <em>_*var glassOrigin : Vector3;*_</em>
 <em>_*var dir : Vector3;*_</em>
 <em>_*var glassDir : Vector3;*_</em>
 <em>_*var damage = 25.0;*_</em>
 <em>_*if(weaponTransformReference == null)*_</em>
 <em>_*{*_</em>
 <em><em>_camRay = cam.ScreenPointToRay(new Vector3(Screen.width * 0.5, Screen.height * 0.5, 0));_</em></em>
 <em>_*origin = camRay.origin;*_</em>
 <em>_*dir = camRay.direction;*_</em>
 <em><em>_origin += dir * 0.1;_</em></em>
 <em>_*}*_</em>
 <em>_*else*_</em>
 <em>_*{*_</em>
 <em><em>_camRay = cam.ScreenPointToRay(new Vector3(Screen.width * 0.5, Screen.height * 0.5, 0));_</em></em>
 <em><em>_origin = weaponTransformReference.position + (weaponTransformReference.right * 0.2);_</em></em>
 <em><em>_if(Physics.Raycast(camRay.origin + camRay.direction * 0.1, camRay.direction, hit, fireRange, hitLayer))_</em></em>
 <em>_*{*_</em>
 <em>_*dir = (hit.point - origin).normalized;*_</em>
 <em>_*if(hit.collider.tag == "glass")*_</em>
 <em>_*{*_</em>
 <em><em>_glassOrigin = hit.point + dir * 0.05;_</em></em>
 <em>_*if(Physics.Raycast(glassOrigin, camRay.direction, glassHit, fireRange - hit.distance, hitLayer))*_</em>
 <em>_*{*_</em>
 <em>_*glassDir = glassHit.point - glassOrigin;*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*else*_</em>
 <em>_*{*_</em>
 <em>_*dir = weaponTransformReference.forward;*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*if(shottingParticles != null)*_</em>
 <em>_*{*_</em>
 <em><em>_shottingParticles.rotation = Quaternion.FromToRotation(Vector3.forward, (cam.ScreenToWorldPoint(new Vector3(Screen.width * 0.5, Screen.height * 0.5, cam.farClipPlane)) - weaponTransformReference.position).normalized);_</em></em>
 <em>_*}*_</em>
 <em>_*if(Physics.Raycast(origin, dir, hit, fireRange, hitLayer))*_</em>
 <em>_*{*_</em>
 <em>_*hit.collider.gameObject.SendMessage("Hit", glassHit, SendMessageOptions.DontRequireReceiver);*_</em>
 <em>_*GenerateGraphicStuff(hit);*_</em>
 <em>_*if(hit.collider.tag == "glass")*_</em>
 <em>_*{*_</em>
 <em>_*if(Physics.Raycast(glassOrigin, glassDir, glassHit, fireRange - hit.distance, hitLayer))*_</em>
 <em>_*{*_</em>
 <em>_*glassHit.collider.gameObject.SendMessage("Hit", glassHit, SendMessageOptions.DontRequireReceiver);*_</em>
 <em>_*GenerateGraphicStuff(glassHit);*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em> 
 <em>_*}*_</em> 
 <em>_*}*_</em>
 <em>_*function GenerateGraphicStuff(hit : RaycastHit)*_</em>
 <em>_*{*_</em>
 <em>_*var hitType : HitType;*_</em>
 <em>_*var body : Rigidbody = hit.collider.rigidbody;*_</em>
 <em>_*if(body == null)*_</em>
 <em>_*{*_</em>
 <em>_*if(hit.collider.transform.parent != null)*_</em>
 <em>_*{*_</em>
 <em>_*body = hit.collider.transform.parent.rigidbody;*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*if(body != null)*_</em>
 <em>_*{*_</em>
 <em>_*if(body.gameObject.layer != 10 && !body.gameObject.name.ToLower().Contains("door"))*_</em>
 <em>_*{*_</em>
 <em>_*body.isKinematic = false;*_</em>
 <em>_*}*_</em>
 <em>_*if(!body.isKinematic)*_</em>
 <em>_*{*_</em>
 <em>_*var direction : Vector3 = hit.collider.transform.position - weaponTransformReference.position;*_</em>
 <em><em>_body.AddForceAtPosition(direction.normalized * pushPower, hit.point, ForceMode.Impulse);_</em></em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*var go : GameObject;*_</em>
 <em>_*var delta : float = -0.02;*_</em>
 <em>_*var hitUpDir : Vector3 = hit.normal;*_</em>
 <em><em>_var hitPoint : Vector3 = hit.point + hit.normal * delta;_</em></em>
 <em>_*switch(hit.collider.tag)*_</em>
 <em>_*{*_</em>
 <em>_*case "wood":*_</em>
 <em>_*hitType = HitType.WOOD;*_</em>
 <em>_*go = GameObject.Instantiate(woodParticle, hitPoint, Quaternion.FromToRotation(Vector3.up, hitUpDir)) as GameObject;*_</em>
 <em>_*break;*_</em>
 <em>_*case "metal":*_</em>
 <em>_*hitType = HitType.METAL;*_</em>
 <em>_*go = GameObject.Instantiate(metalParticle, hitPoint, Quaternion.FromToRotation(Vector3.up, hitUpDir)) as GameObject;*_</em>
 <em>_*break;*_</em>
 <em>_*case "car":*_</em>
 <em>_*hitType = HitType.METAL;*_</em>
 <em>_*go = GameObject.Instantiate(metalParticle, hitPoint, Quaternion.FromToRotation(Vector3.up, hitUpDir)) as GameObject;*_</em>
 <em>_*break;*_</em>
 <em>_*case "concrete":*_</em>
 <em>_*hitType = HitType.CONCRETE;*_</em>
 <em>_*go = GameObject.Instantiate(concreteParticle, hitPoint, Quaternion.FromToRotation(Vector3.up, hitUpDir)) as GameObject;*_</em>
 <em>_*break;*_</em>
 <em>_*case "dirt":*_</em>
 <em>_*hitType = HitType.CONCRETE;*_</em>
 <em>_*go = GameObject.Instantiate(sandParticle, hitPoint, Quaternion.FromToRotation(Vector3.up, hitUpDir)) as GameObject;*_</em>
 <em>_*break;*_</em>
 <em>_*case "sand":*_</em>
 <em>_*hitType = HitType.CONCRETE;*_</em>
 <em>_*go = GameObject.Instantiate(sandParticle, hitPoint, Quaternion.FromToRotation(Vector3.up, hitUpDir)) as GameObject;*_</em>
 <em>_*break;*_</em>
 <em>_*case "water":*_</em>
 <em>_*go = GameObject.Instantiate(waterParticle, hitPoint, Quaternion.FromToRotation(Vector3.up, hitUpDir)) as GameObject;*_</em>
 <em>_*break;*_</em>
 <em>_*default:*_</em>
 <em>_*return;*_</em>
 <em>_*}*_</em>
 <em>_*go.layer = hit.collider.gameObject.layer;*_</em>
 <em>_*if(hit.collider.renderer == null) return;*_</em>
 <em>_*if(timerToCreateDecal < 0.0 && hit.collider.tag != "water")*_</em>
 <em>_*{*_</em>
 <em>_*go = GameObject.Instantiate(bulletMark, hit.point, Quaternion.FromToRotation(Vector3.forward, -hit.normal));*_</em>
 <em>_*var bm : BulletMarks = go.GetComponent("BulletMarks");*_</em>
 <em>_*bm.GenerateDecal(hitType, hit.collider.gameObject);*_</em>
 <em>_*timerToCreateDecal = 0.02;*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*function Update()*_</em>
 <em>_*{*_</em>
 <em>_*timerToCreateDecal -= Time.deltaTime;*_</em>
 <em>_*if(Input.GetButtonDown("Fire1") && currentRounds == 0 && !reloading && freeToShoot)*_</em>
 <em>_*{*_</em>
 <em>_*PlayOutOfAmmoSound();*_</em>
 <em>_*}*_</em>
 <em>_*if(Input.GetButtonUp("Fire1"))*_</em>
 <em>_*{*_</em>
 <em>_*freeToShoot = true;*_</em>
 <em>_*cBurst = burstRate;*_</em>
 <em>_*}*_</em>
 <em>_*HandleReloading();*_</em>
 <em>_*ShotTheTarget();*_</em>
 <em>_*}*_</em>
 <em>_*function HandleReloading()*_</em>
 <em>_*{*_</em>
 <em>_*if(Input.GetKeyDown(KeyCode.R) && !reloading)*_</em>
 <em>_*{*_</em>
 <em>_*Reload();*_</em>
 <em>_*}*_</em>
 <em>_*if(reloading)*_</em>
 <em>_*{*_</em>
 <em>_*reloadTimer -= Time.deltaTime;*_</em>
 <em>_*if(reloadTimer <= 0.0)*_</em>
 <em>_*{*_</em>
 <em>_*reloading = false;*_</em>
 <em>_*if(!unlimited)*_</em>
 <em>_*{*_</em>
 <em>_*totalClips--;*_</em>
 <em>_*}*_</em>
 <em>_*currentRounds = clipSize;*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*function Reload()*_</em>
 <em>_*{*_</em>
 <em>_*if(totalClips > 0 && currentRounds < clipSize)*_</em>
 <em>_*{*_</em>
 <em>_*PlayReloadSound();*_</em>
 <em>_*reloading = true;*_</em>
 <em>_*reloadTimer = reloadTime;*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*//---------------AUDIO METHODS--------*_</em>
 <em>_*function PlayOutOfAmmoSound()*_</em>
 <em>_*{*_</em>
 <em>_*audio.PlayOneShot(outOfAmmoSound, 1.5);*_</em>
 <em>_*}*_</em>
 <em>_*function PlayReloadSound()*_</em>
 <em>_*{*_</em>
 <em>_*audio.PlayOneShot(reloadSound, 1.5);*_</em>
 <em>_*}*_</em>
 <em>_*function PlayShootSound()*_</em>
 <em>_*{*_</em>
 <em>_*audio.PlayOneShot(shootSound);*_</em>
 <em>_*}*_</em>
<em>_*}*_</em>
<em>_*```*_</em>

Your trainingDummy class has a function called Hit that takes 2 arguments. You need to open up your trainingDummy class and make Hit method take a single argument of type RaycastHit.