- Home /
BCE0005: Unknown identifier: 'DirectionRay'.
The errors: 
Assets/Scripts/Shoot.js(73,36): BCE0005: Unknown identifier: 'DirectionRay'. 
Assets/Scripts/Shoot.js(74,41): BCE0005: Unknown identifier: 'DirectionRay'. 
Assets/Scripts/Shoot.js(83,35): BCE0005: Unknown identifier: 'DirectionRay'. 
 var Range : float = 1000;
 var Force : float = 1000;
 var Clips : int = 2;
 var BulletsPerClip : int = 16;
 var ReloadTimer : float = 0;
 var ReloadCooler : float = 3.3;
 var Damage : int = 10;
 var BulletsLeft : int = 16;
 var ShootTimer : float = 0;
 var ShootCooler : float = 0.09;
 public var ShootSound : AudioClip;
 public var ReloadSound : AudioClip;
 public var EmptySound : AudioClip;
 var HitParticles : ParticleEmitter;
 function Start ()
 {
 BulletsLeft = BulletsPerClip;
 HitParticles.emit = false;
 }
 function Update ()
 {
 if(ReloadTimer > 0)
 {
 ReloadTimer -= Time.deltaTime;
 }
 if(ReloadTimer < 0)
 {
 ReloadTimer = 0;
 }
 if(ShootTimer > 0)
 {
 ShootTimer -= Time.deltaTime;
 }
 if(ShootTimer < 0)
 {
 ShotTimer = 0;
 }
 if (BulletsLeft < 0)
 {
 BulletsLeft = 0;
 }
 if(Input.GetMouseButtonDown(0) && ShotTimer == 0)
 {
 if(BulletsLeft > 0)
 {
 if( ShootTimer == 0)
 {
 PlayShotSound();
 ShootTimer = ShootCooler;
 Shot();
 BulletsLeft --;
 }
 }
 if(BulletsLeft == 0 && Clips == 0)
 {
 if( ShootTimer == 0)
 {
 PlayEmptySound();
 ShootTimer = ShootCooler;
 }
 }
 if(BulletsLeft == 0 && Clips > 0 && ReloadTimer == 0)
 {
 PlayReloadSound();
 Reload();
 }
 }
 }
 function Shot ()
 {
 var Hit : RaycastHit;
 var DirectionRav = transform.TransformDirection(Vector3.forward);
 Debug.DrawRay(transform.position , DirectionRay * Range , Color.red);
 if(Physics.Raycast(transform.position , DirectionRay , Hit, Range))
 {
 if(Hit.rigidbody)
 {
 if(HitParticles)
 {
 HitParticles.transform.position = Hit.point;
 HitParticles.transform.localRotation = Quaternion.FromToRotation(Vector3.forward, Hit.normal);
 HitParticles.Emit ();
 Hit.rigidbody.AddForceAtPosition( DirectionRay * Force , Hit.point);
 HitParticles.collider.SendMessageUpwards ("ApplyDamage" , Damage, SendMessageOptions.DontRequireReceiver);
 }
 }
 }
 }
 function Reload ()
 {
 ReloadTimer = ReloadCooler;
 yield WaitForSeconds(ReloadTimer);
 BulletsLeft = BulletsPerClip;
 Clips --;
 }
 function PlayShotSound ()
 {
 audio.PlayOneShot (ShootSound);
 }
 function PlayReloadSound ()
 {
 audio.PlayOneShot (ReloadSound);
 }
 function PlayEmptySound ()
 {
 audio.PlayOneShot (EmptySound);
 }
               Comment
              
 
               
              Answer by KellyThomas · Jan 19, 2014 at 02:49 PM
Looks like a simple typo:
 var DirectionRav = transform.TransformDirection(Vector3.forward);
Should be:
 var DirectionRay = transform.TransformDirection(Vector3.forward);
Your answer
 
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
i just got unity and when i open the program i get a error saying transaction is invalid 2 Answers
error CS0246 anybody help? 1 Answer
Getting Unknown Identifier Error 1 Answer
SCRIPT NOT WORKING 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                