How to check for a missing class ( error CS0103 ) and act accordingly


I would like to make my code aware of a missing class and act accordingly.

So let's say that I have a class called "InputBroker", if it exists then I use it, else I call directly the Input manager.

Currently I get the following and expected error: error CS0103: The name `InputBroker' does not exist in the current context

how can achieve this? I am using c#.

Thanks for your help,


Use the string version of GetComponent, get by name. If it returns null, it does not exist. I would imagine if you need a class, use the base class 'Component' (for variable type, say)

could some one help me it came up w/ the same error but i cant fix it it says “Error ‘RotationX’ does not exist,” yes I am using C# so please help me

could you clarify that for me please