Hello, I come from a Java background and am new working with Unity.
Let's say that I have this gameObject with an Entity component, all Entities must have
a health variable.
In Java, I would have made Health a class and given Entity an instance variable Health, however, If i were to do that to Entity (for example a Health script), I would in fact be able to give the Entity the script, however, I would not be able to modify it for that particular Entity, since it only gives me the option to give it a Health script, but not to modify it.
I guess my question is, In Unity, is it good practice to give the prefab all the components it will need (an Entity component, Health component, Inventory component) etc
instead of giving the Entity component all the instance variables it may make sense for an Entity to have?
Thanks a ton!
↧