- Home /
Question by
Setzer22 · Jun 13, 2012 at 04:48 PM ·
mono-behaviour
Can a script have two monobehaviour classes?
Hello everyone.
Quick question, the title says it all, can I have a script with two monobehaviour classes on it? Then, which one would be attached to the gameObjetct? the one with the name of the script?
Thank you very much
Comment
Best Answer
Answer by whydoidoit · Jun 13, 2012 at 04:50 PM
The editor gets confused if you don't have a class with the same name as the file. In general it is better to keep them separate - although I believe AddComponent can be used to add other classes from the file.