- Home /
Unity exports my derived class, but not its base class (C# OOP) - Is there a workaround?
I'm having trouble exporting a prefab with all its dependencies, specifically the base class of my derived class.
For example:
Let's assume I have an Engine class and a SpecialEngine class which is derived from the Engine class.
I add the SpecialEngine component to a gameobject.
I create a prefab from the gameobject.
I right-click my prefab and choose "Select Dependencies".
It selects the SpecialEngine class but not the Engine class which means that if I export the prefab with the suggested selection and import the package into a different project it will not be able to compile due to the missing base class.
Does anyone know of a good workaround?
I guess I could attempt to write an Editor script that loops through the components of the main gameobject in the prefab and all its children and adds the base class files to the depency selection.
If someone has already written such a script, please share it :)
Your answer
Follow this Question
Related Questions
Does Script Execution Order effects extend to the descendants of the listed classes? 2 Answers
Scalable system logic 1 Answer
Is the Asset export function broken? 10 Answers
Using child class variables while in a parent class array. 1 Answer
Making a static class derive from MonoBehaviour in C# 3 Answers