Using Custom Classes and Constructors
Custom classes are classes held within your script that ignores monobehavior. The monobehavior class can reference the class elements in the custom class. If we were to create a weapon inventory system, we can have each item have a sort of blueprint for it’s elements in that custom class. To build it, you need to add a custom class above monobehavior.
Now in our monobehavior class, let’s create the variable blasters that will use the class weaponsstats.
Once that’s complete, in our start method, we need to generate the blasters and then fill in details.
If I wanted to add more to the class, I need to create a new rocket and fill in the stats.
This explains custom classes, but this is a slow process that can be difficult. To make things easier, we should use a constructor. WE start the constructor similar to a function and we pass in parameters that we can define.
Then in our start, we can simply add new data to our class.