2nd class in same file is "inactive" ?
I have a class called Player in my Player.cs file, and I also have a class called PlayerUI in the same file.
In the first class "Player", everything gets called properly.
However, in the second class "PlayerUI", no Update function gets called, and none of the serializefield variables show up in inspector.
Is it not possible to have 2 classes in the same file in unity C# or am I doing something very wrong?
Answer by JedBeryll · Jun 19, 2016 at 12:32 PM
I don't think it's possible because the file name must match the class name and you can't create 2 classes with the same name in the same namespace.
Ah :/ Well, I'd rather not create a file for every function in my game... I guess I'll just throw everything into the same class. :(
Your answer
![](https://koobas.hobune.stream/wayback/20220612083236im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Using a subclass in the inspector in place of a parent class and accessing the subclass variables 1 Answer
float value carries over from runtime causing issues + it doesnt update in the inspector 0 Answers
Values added during editor mode are removed when starting playmode 2 Answers
How to add a editing option to variables in a script in Inspector? 0 Answers
C# Find specific object by getting one of its variables 0 Answers