Computer Language/Unity
[Unity] Prefab / Class Inheritance
정우섭
2019. 3. 7. 00:14
Prefab
Prefab is a file of an object which is not materialized in game, but you can use it by script, such as 'public GameObject stone;'.
To make a Prefab you have to drag an object from Hierarchy View to Game View.
Class Inheritance
If you write another class name instead of MonoBehaviour the class inheritates the other.
For example,
public class B : A {
}
In this code class B inherits class A. And when you inherits class B to class A, class B also follows parents class A's code, such as if statement and so on.
When you want to call a function from A to B, use base.functionFromA().
But the function you call from parent class must be allowed to be called by protected void functionA().