In this lesson, we put a non-static script into “Tower” component. We have a “Tower” serialized field where we drag a prefab to - so something I would think is a non instanciated type.
How does it work that we can actually call normal methods on it? What if those methods modified something - would all object instanciated from it contain that modification? What is a MonoBehaviour then?
Hi @anula,
What do you mean by “non-static script”? Generally, classes inheriting from MonoBehaviour are never static because we must create objects (components) from those classes.
What is a MonoBehaviour then?
MonoBehaviour is a class provided by Unity. If we make our script inherit from MonoBehaviour, we can assign our script to a game object in the editor and create a component.
We have a “Tower” serialized field where we drag a prefab to - so something I would think is a non instanciated type.
The tower prefab is not instantiated in our scene, but it is still an object.
What exactly would you like to know? What does not make sense yet?