Tell me how to do it in terms of memory optimization.
I have a vehicle script. Only one vehicle has a weapon. I want to make a script of weapons. How best to keep a link to it? What would the vehicles without weapons have, was not the allocation of extra memory?
As an option to make a script of weapons “ScriptableObject”. And I add the variable “public VehicleWeapon weapon” to the script of the vehicle itself. If the field is empty, will the memory be allocated?