Reply To: Is there something between a public variable and a static public variable?

Forum Archive Is there something between a public variable and a static public variable? Reply To: Is there something between a public variable and a static public variable?

#38206
Jonathan Gonzalez
Participant

    @eithman I can put together a small example later today if I have time. The gist of it is that you’d create the family base class and that could either reside on an object in your game or solely in your project panel. Then you’d create child classes that derive from that class. 

    Whenever you create a script in Unity it automatically derives from Monobehaviour which is the base class. It’s not one you created but it allows you to utilize things from that base class. Same would be true for your custom classes. 

    So all of this would be done through the scripting aspects. The animals you’d instantiate would need to have the classes that you want. You would be creating that yourself and managing it. 

    So a quick example of this. Create a dog class. Add that to the main animal in the game. Then create a second class called Puppy that derives from the dog class. Those objects with the puppy class would be the objects you’d want instantiated from the object that has the dog class and no other.