Prefabs - Reading Assignment

Read this article: https://docs.unity3d.com/Manual/Prefabs.html

1. What is a prefab?
2. Why should we use a prefab instead of copying the GameObjects?
3. Give some examples of situations in which a prefab might be necessary.

1 Like

1. What is a prefab?
A prefab is a way to create copies of a ‚Äėpreviously fabricated‚Äô item. You can then use them everywhere and can manipulate many instances while only making changes to the original.

2. Why should we use a prefab instead of copying the GameObjects?
This will save us a lot of time.

3. Give some examples of situations in which a prefab might be necessary.
NPCs, props, or pieces of scenery.

1 Like

1. What is a prefab?
An instance which you can load in your project which will have values and behaviors which you can connect to objects.

2. Why should we use a prefab instead of copying the GameObjects?
When you update a prefab it will automatically update your wish to all the objects where the prefab is related to. When you use copy, you have to update all the scripts when you want to implement a change.

3. Give some examples of situations in which a prefab might be necessary.
For example, behavior of trees or campfires. Or other objects which are used regularly.

1. What is a prefab?
A Prefab is an object that acts as a template so that it can be instantiated multiple times in a scene but be conveniently manipulated in one place so that all instantiations have the same properties and are in sync.
2. Why should we use a prefab instead of copying the GameObjects?
Because of the convenience of being able to keep copies in sync if we need several objects of the same type. GameObjects can be altered individually which may not be desirable.
3. Give some examples of situations in which a prefab might be necessary.
NPCs (enemy characters of the same class such as Orcs or soldiers for example)
Collectibles (Bananas, Coins in Platformers)

Prefabs

  1. Prefabs are templates for reusable objects
  2. Always avoid copy/paste code :-) make it easier to use and modify during the game.
  3. The Main Player Character and Non Player Characters like ivanOntech-zombies or robots.
    Environmental assets like tree's or filip's chair.
    Projectiles like asteroids, atomic clockbullets :-)
    Creating special effects during the game.
    ...

greetzzz