I’m getting a little confused about the use of Types inside code.
In this lesson, for instance, in the Attacker class, we used
GameObject currentTarget
to store the target. But sometimes we use the classes we’ve created to define variables and attributes, like:
Attacker attackerPrefab
Defender defenderPrefab
Defender newDefender = Instantiate(…) as Defender;
and so on. When to use GameObject and when to use our classes? What’s the difference?
Could this lesson example be
Defender currentTarget
instead of GameObject currentTarget?
And another question. When we define a Serialized Field to store a prefab, like the examples above, sometimes, when I open the field in the inspector, I get a list of filtered list of prefabs for the defined type, sometimes I get nothing, only an empty window. Why does this happen?
I’m using Unity 2020.1.3f1 Personal, BTW