Quantcast
Channel: Questions in topic: "declare"
Viewing all articles
Browse latest Browse all 78

C#: Declaring a script as a variable

$
0
0
public class WallProperties : MonoBehaviour { public Door door; public bool IsDoor(bool enable) //enable=true { if(enable) { print (enable); //prints true door=new Door(); door.DoorStart(); //sets values to default print(door.GetStyle ()); //prints current value print ((door==null)?"True":"False"); //prints true } return(door==null); //returns true } ... }
  • I am trying to have the 'door' variable not NULL
  • The mono class is not attached to anything
  • It gave me lip when the "new Door()" was removed
  • With the "new Door()" I am able to access the Door class
However, the variable 'door' stays NULL. Is there a way that the 'door' variable can be declared and not be NULL or should I just have a boolean class variable for the door?

Viewing all articles
Browse latest Browse all 78

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>