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
Post a Comment