Creating a switch for checking if a GameObject has a Script attached
Hey Community, I am trying to create a way to manage a mouse click in one class. Depending on what kind of GameObject is clicked: the object will do an action. I am planning on making Clickable Objects into an interface all containing a clickedOn() method, but I've been wrapping my head around the possibility of a Switch/Case statement that checks if a GameObject contains specific Scripts. The switch statement will then do an action depending on what kind of Script it finds on the object.
I am not suggesting that I think that this would be a better solution. I just want to know if it is at all possible.
Your answer
Follow this Question
Related Questions
Unity Inheritance and Monobehaviour 1 Answer
How to change image of button when clicked? 2 Answers
Breaking Object by Destroying it and Instantiating Broken Parts problem, help! 2 Answers
Destroying object multiple times. 0 Answers
http://answers.unity3d.com/questions/8472/help-with-error-expression-denotes-a-type-where-a.html 1 Answer