I am making a game where the player buys different units from a store to assemble an lineup of units that fight enemies automatically. I would like to define a parent Unit that has all code common across all units. I would like to define properties and methods that only apply to an individual unit in each individual unit class.
1. can I instantiate a new specific unit without having a scene for each individual unit? I only have created a scene in the editor for the parent unit and only have .gd files for the children
2. what is the best way to store information about each unit where it can be accessed without adding the unit to the scene tree? like in the store I need access to the properties of specific units to display them, so I just made a 2D array of all my units properties as a singleton by instantiating and adding each unit as a child, storing its properties in the array, and then changing the scene, and get them using [unitId][propertyId] to display in the store. I feel like there has to be a better way to do that.
3. can I define a method in a parent class so that I can call it in the parent class, but define the method differently in each child class?