What are the conventions for overloading classes?

I have a project where I need to have several different variations of one class, and my system works fine except that I can’t apply these overloaded classes to any objects.

My project works like this: I have a ‘buildingBlock’ class, which has functions to be placed and deleted. I want to have a block that has more functions, for example a door that can be opened and closed. For this, I have made a class ‘doorBlock’ that inherits from ‘buildingBlock’ and this works fine in code, but because I made this overload class inside the ‘buildingBlock’ script I can’t apply it to any objects.

My question is whether I should have the ‘doorBlock’ class in another script, or if there’s some way to choose between classes inside of a script from the editor. Doing it either way isn’t really a problem, it just seems like it would be a mess to have a bajillion different scripts that are all slightly different.

From what I understand, you put both buildingBlock class (which is a MonoBehaviour) and doorBlock class (which inherits from buildingBlock) in a single file, and you want to attach the doorBlock to a GameObject.

Unfortunately there can not be more than one MonoBehaviour in a file. Since buildingBlock is a MonoBehaviour, doorBlock is a MonoBehaviour too. You will need to put the doorBlock class in new file in order to apply it to any GameObject.