unity3d - Unity c# Object reference not set to an instance of an Object ( Shooting Script ) -



unity3d - Unity c# Object reference not set to an instance of an Object ( Shooting Script ) -

using unityengine; using system.collections; public class weapon : monobehaviour { public string name; public int rateoffire; int rof; public int accuracy; public int ammo; public bullet amunition; public pcp shootingpoint; [hideininspector] public bool isactive = false; void start () { rof = 0; } // update called 1 time per frame public void weaponupdate () { if(rof != 0) { rof --; } } public void shoot() { if(ammo > 0 && rof == 0) { shootingpoint.sendmessage("create",amunition); ammo --; rof = rateoffire; } }

}

"note : pcp shortcut prefab shooting point".

i got error in shooting method in line "shootingpoint.sendmessage" dont understand why ? , have components @ objects placed in shootingpoint , ammunation , wrong ??

here image prove attached objects :

either shootingpoint or amunition aren't objects yet. they're 2 things on line causing issue.

c# unity3d nullreferenceexception

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -