NullReferenceException ? why?

hey guys i hope someone can tell my why an object which hits the player tell me:
NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Type[ ] cacheKeyTypes, System.Object[ ] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)

the player is an instance, the enemy is an instance.
well, shooting the enemy is the same method and it works, but if the enemy is shooting me i get this message.
here is the laser script from the enemy, it contains the var EnemyLaserDmg which should be send.
http://pastebin.com/aFX4AMir
and here the collider (tag == “Player”) which send the message to the ener_cal script
http://pastebin.com/Pg40kZ2N

as you can see the debug log show HIT PLAYER COLLIDER if “Player” is hit by the laser, and yes the debug log says: HIT PLAYER COLLIDER but hit.SendMessage(“SendLaserDmgToTarget”, EnemyLaserDmg); leads to NullReferenceException… so function SendLaserDmgToTarget(EnemyLaserDmg: float) isn´t called. and of course Debug.Log(“DAMAGE DELIEVERED!!!”); will never be called…but why?

so here´s the working example. the playerlaser script:
http://pastebin.com/7pLipbEy
and the enemy collider
http://pastebin.com/W58THdkB
this is 100% working and uses the same way

from player to enemy → works
from enemy to player → …error

Well, the “hit” variable can’t be a null reference, so maybe the problem is in your SendLaserDmgToTarget method. It seems like the most likely cause would be that your “connect” variable is still null somehow. Does your error message say that the null reference was on that hit.SendMessage line? Maybe you can try putting in a Debug statement to see if it is your “connect” variable.

19.function SendLaserDmgToTarget(EnemyLaserDmg: float){

           Debug.Log("connect is " + (connect == null ? "Null" : "Valid"));

20.        if(connect.currShield > 0){
21.                        connect.SendMessage("SubtractShield", EnemyLaserDmg);
22.                        conToHitSoundObj.audio.Play();
23.                        conToHitSoundObj.audio.pitch = Random.Range(0.60,0.75);
24.                        Debug.Log("DAMAGE DELIEVERED!!!");
25.        }
26.        if(connect.currShield <= 0  connect.currEnergy > 0){
27.                        connect.SendMessage("SubtractEnergy", EnemyLaserDmg);
28.                        conToHitSoundObj.audio.Play();
29.                        conToHitSoundObj.audio.pitch = Random.Range(0.60,0.75);
30.        }
31.        
32.}

thanks for the suggestion! i´m still not sure why this error appeared. i put a dummy together for a bug report because skybox+ cam+prefab leads to a crash and i swear i never missed any links. it´s a kind of funny because the bug disappears but this error appears. :slight_smile: well, i still got my working version.