Does Unity C# support partial classes?

Does Unity C# support partial classes (classes spread across multiple files, a feature often used when auto-generating part of a class and hand-coding the rest)? If so, are there any Unity-specific guidelines or caveats one should be aware of?

yes!!! you can use partial classes in your games. you should attach the file with the same name as your class name to your GameObject.

for example there is a file called "ball.cs" and a file called "ball2.cs" both files have a class called "ball"

public partial class ball : MonoBehaviour { //some methods and functions }

you should add the "ball.cs" file as a component to your gameobjects othervise unity will say the file name does not match any of classes in the file.

you can easily test things like this and get a fast answer just as i tested this for you also you can check features of each mono version in

Adding the files as they are, in Unity 5, DOES not work. BUT adding a stub with the filename will make it work.

what i did: 3 partial files:

GameController.cs  // main

all are declared with public partial class GameController : MonoBehaviour { ... class code ... }

Number 2 and 3 can only be included (appended to the emtpy object, as GameController.cs is) if they contain as last line

public class GameController_Connections : MonoBehaviour { /* EMPTY! */ }

→ matching their file names. If not added, Unity will reject them.