Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Error : Unknown identifier : FlashLight

$
0
0
Hello, I recently created a life script of the battery of my lamp. Here it is : #pragma strict var flashLight : Light; function Start () { flashLight.GetComponent.().enabled = false; flashLight.GetComponent.().intensity = 8; } function Update () { if(flashLight.GetComponent.().enabled == true) { flashLight.GetComponent.().intensity -= 0.1 * Time.deltaTime / 5; Debug.Log(flashLight.GetComponent.().intensity); } } I then downloaded a script on the Internet that allows to collect batteries, but I can not start the game because of the error: Unknown identify FlashLight. var buttonInRange; var buttonActivated; var batterySound : AudioClip; private static var batteryPower : float = 10; public var guiSkin : GUISkin; private var hasPlayed = false; function OnTriggerEnter (c : Collider) { buttonInRange = true; } function OnTriggerExit (c : Collider) { buttonInRange = false; } function OnGUI () { if(buttonInRange == true) { GUI.skin = guiSkin; GUI.Label (Rect (Screen.width/2-50, Screen.height/2-55, 120, 50), "Pick up batteries"); } } function Update () { if (buttonInRange == true) { if (Input.GetKeyDown ("e")) { if(!hasPlayed) { AudioSource.PlayClipAtPoint(batterySound, transform.position); Flashlight.AlterEnergy(batteryPower); Destroy(gameObject); hasPlayed = true; } } } } I think we should add a variable but I do not know which. Thank you.

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>