c# - Assign script instead of GameObject in editor? -


i'm connecting gameobjects assigning them in editor.

all need script assigned gameobject have this:

public class gameboard : monobehaviour {     //assigned gameobject containing scorescript in editor     public gameobject totalscore;       private scorescript totalscorescript;      void start() {         totalscorescript = this.getcomponent<scorescript>();     } } 

is there better way achieve result?

just use scorescript public variable. assign drag game object script attached normal via editor. works builtin components transform.

public class gameboard : monobehaviour {     public scorescript totalscorescript; } 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -