Question by
issamboy · Apr 09, 2016 at 06:22 PM ·
javascript
MissingMethodException: UnityEngine.Light.AlterEnergy
When I try to pick up a battery I get this error :
MissingMethodException: UnityEngine.Light.AlterEnergy
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher ()
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create ()
Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object[] args)
Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target, System.String name, System.Object[] args)
Boo.Lang.Runtime.RuntimeServices+<Invoke>c__AnonStorey15.<>m__9 ()
Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args)
UnityScript.Lang.UnityRuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args, System.Type scriptBaseType)
Battery.Update () (at Assets/Horror Hospital Pack/Battery.js:45)
Here's the script I'm Using :
var buttonInRange;
var buttonActivated;
var batterySound : AudioClip;
var FlashLight : Light;
private static var batteryPower : float = 1;
private static var batteryLife : float = 0.0;
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");
}
}
static function AlterEnergy (amount : int)
{
batteryLife = Mathf.Clamp(batteryLife+batteryPower, 0, 100);
}
function Update ()
{
if (buttonInRange == true)
{
if (Input.GetKeyDown ("b"))
{
if(!hasPlayed)
{
AudioSource.PlayClipAtPoint(batterySound, transform.position);
FlashLight.AlterEnergy(batteryPower);
Destroy(gameObject);
hasPlayed = true;
}
}
}
}
Comment