Sunday, 15 June 2014

get component error Unity3d C# -



get component error Unity3d C# -

here script maintain getting null reference exception, don't know do? assign where?

using unityengine; using system.collections; public class currencymanagment : monobehaviour { public int coins; public creditplayer creditplayerscript; void start () { creditplayerscript = getcomponent<creditplayer>(); } void awake() { creditplayerscript = getcomponent<creditplayer>(); } void update () { coins = creditplayerscript.coinstempcontainer; } }

it seems don't have creditplayer script attached same game object have currencymanager. drag , drop script game object (with game stopped, not running).

you can programatically, adding requirecomponent attribute automatically add together scripts specify. take @ this document.

c# unity3d game-engine

No comments:

Post a Comment