Hi, I know how to set a variable type as “script” like -
var buttonsScript : Buttons;
But what I’d like to do is set them in Start() upon the true or false of a boolean.
So what I have in Start() is -
function Start(){
buttons = GameObject.Find("GUI Buttons");
// Is the player playing Multiplayer ?
if(globalVarsScript.multiplayer){
buttonsScript = buttons.GetComponent(NetworkButtons);
}else{
buttonsScript = buttons.GetComponent(Buttons);
}
And a part in one of my functions is -
buttonsScript.touchBegan = false;
buttonsScript.touchBegan = false;
buttonsScript.fireBegan = false;
But doing it this way I get the error - Cannot convert ‘NetworkButtons’ to ‘Buttons’. for the line -
buttonsScript = buttons.GetComponent(NetworkButtons);
Because I thought I could change the variable buttonScript in Start(), is there a way to set the variable buttonScript as type “script” without giving it the script name?