as it is possible to check a GameObect for its existence (or instantiation) like this,:
GameObject x = new GameObject();
if(x){
Console.Writeline("Instantiated GO");
}else{
Console.Writeline("Not instantiated GO");
}
how do i check a Object of my own class for existence/instantiation ? I just get the error, that it could not be converted to bool.
My Question: How can I check objects of my own class like the GameObjects in Unity as shown in the code above ?
How do i fix this ? Is it Unity specific ?:
class myClass{
public myClass(){ //Construcutor}
public void createAndCheckClassObject(){
myClass y = new myClass();
if(y){
Console.Writeline("Instantiated object");
}else{
Console.Writeline("Not instantiated object");
}
}
}