Sorry, Im so sorry if my english not good but i want to say if my code is error i dont understand this is why but its not work for me
OK, So this makes it clear. You don’t have a Controller
class. You are trying to find a type that doesn’t exist. You named the file Controller
but the class is ExampleClass
. The filename doesn’t really matter. It does to Unity because that’s a thing they do for components, but the code don’t care about your filenames. You should be able to FindObjectOfType<ExampleClass>()
but Unity will still complain because MonoBehaviour
classes should match the filename, so you need to rename the ExampleClass
to Controller
1 Like
Welcome to our community!
The error message says: VS Code does not know ‘Controller’. Where does the name ‘Controller’ come from? Do you have a script named ‘Controller’?
1 Like