Several Monster Models (Spawn)

Hello all,

I was about to start adding simple AI scripts onto my entity prefab and its model. But how to do this if you have different monster models while their scripts are the same? Do I have to create a prefab and link the same script for every monster model? It would be great if there is a way to do it with only one prefab, so I can spawn certain variant of the prefab. Maybe Instantiate and attach model to prefab while mirror spawns the prefab?

  • In Unity, we distinguish Prefabs and Variants.

  • A prefab can be, for example, a basic model containing elementary components (something like a base class, but don't has to).

  • A variant, on the other hand, can be something more specialized based on a prefab (i.e. something like an inheriting class).

  • If you have an enemy spawn script, you can put a public List in it, and then add more prefabs/variants to the list (by dragging and dropping).

  • Now you can think of a way to spawn enemies, e.g. randomly by selecting an index from a range in the list or according to a specific scenario/pattern.

  • You can place different monster AI behaviors through components (each Variant can have different component).

1 Like