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.

2 Likes

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 Like

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)

1 Like

2 Likes

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

1 Like
  1. A prefab is a set of game objects that share similar attributes that the developer likely wants to make changes to all at once.

  2. Saves time developing and gives flexibility of control in case any individual objects need special treatment.

  3. The coins in the game we’re building now. Power-Ups, common NPCs, common buildings or scenery.

1 Like

1. What is a prefab?
When you want to reuse a GameObject, like a tree to be present on more places in game, you can use prefab system.
2. Why should we use a prefab instead of copying the GameObjects?
Because any edits you make on prefab asset are automatically reflected in instances of prefab asset objects. This is allowing to easily make broad changes across the whole Project or Game without need to input the same edit for every asset.
3. Give some examples of situations in which a prefab might be necessary.
environmental asset like tree, it can be used multiple times on a level of game
non-player characters like robot, it can appear in game multiple times on different levels
projectiles like missile it can be instantiated every time when missile launcher fires
player’s main character, it can be placed at the starting point of each level

1 Like

1. What is a prefab?

A GameObject that we use more than one time.

2. Why should we use a prefab instead of copying the GameObjects?

It makes it easier to edit GameObjects as all edits are propagated automatically to all instances.
It is also used if you want to spawn GameObjects during the game, at a moment different than frame 0.

3. Give some examples of situations in which a prefab might be necessary.

Environmental Assets
NPCs
Projectiles
The player’s main character

1 Like
  1. A prefab is a stored game object that is used to copy all parameters of a previously created object to be accessible as a reusable asset.

  2. A prefab should be used instead of copying objects because the prefab will be synced across all instantiations.

  3. The most common uses of prefabs are main game characters, environment elements, and other objects that are used multiple times.

1 Like

1. What is a prefab? The Prefab Asset acts as a template from which you can create new Prefab instances in the Scene.
2. Why should we use a prefab instead of copying the GameObjects? When you want to reuse a GameObject configured in a particular way in multiple places in your Scene, or across multiple Scenes in your Project
3. Give some examples of situations in which a prefab might be necessary.

  • Environmental Assets - for example a certain type of tree used multiple times around a level (as seen in the screenshot above).
  • Non-player characters (NPCs) - for example a certain type of robot may appear in your game multiple times, across multiple levels. They may differ (using overrides ) in the speed they move, or the sound they make.
  • Projectiles - for example a pirate’s cannon might instantiate a cannonball Prefab each time it is fired.
  • The player’s main character - the player prefab might be placed at the starting point on each level (separate Scenes) of your game.
1 Like
  1. You can define any asset (e. g. a character, item) as a prefab. From this prefab you can generate as much as instances you need. The advantage here is that when you make a manipulation at the prefab, all of the instances will change automatically to the prefab conditions (e. g values, properties…) .

  2. With prefabs you save a lot of time and effort, because you have to make changes just for the prefab and not on all instances of it. When you just copy the GameObjects you need to make every change to every GameObject. So, prefabs are easy to use.

  3. Objects which appears on different scenes and they need to be updatable. For example characters or grass and clouds. Dependent on the weather they change their properties (move faster, change color…)

1 Like
  1. A prefab is used for creating, storing, configuring a asset.
  2. It is much easier to have multiple objects = 1 object than have them be separated in to multiple objects.
  3. Coins, Enemies.
1 Like
  1. What is a prefab?
    A Prefab acts as a template from which you can, create new instances that have some shared properties, and can also be manipulated separately.

  2. Why should we use a prefab instead of copying the GameObjects?
    Because the Prefab system allows you to automatically keep all the copies in sync.

  3. Give some examples of situations in which a prefab might be necessary.
    NPCs, Player Character, Environmental Assets, and other objects that you might want to reuse more than one place in your game.

1 Like
  1. A prefab is a reusable asset in Unity.

  2. A prefab is used as a template so you can create it across multiple scenes. This allows you to automatically keep the copies in sync.

  3. A prefab might be necessary when you want game objects that were not there at the start to appear during gameplay, e.g. a projectile (a pirate’s cannon might instantiate a cannonball prefab each time it’s fired), environmental assets (a certain kind of tree might appear at multiple instances), non-player characters (a certain kind of robot may appear multiple times across multiple levels).

1 Like
  1. Prefab System is what allows you to create, configure, and store a GameObject complete with all its components, property values, and child GameObjects as a reusable Asset.
  2. Because “the Prefab system allows you to automatically keep all the copies in sync” - Can you please explain what it means?
    3.Environmental Assets
    Non-player characters
    The player’s main character
  1. What is a prefab?
    • prefab acts as a template from which you can create new instances in a scene
  2. Why should we use a prefab instead of copying the GameObjects?
    • the Prefab system allows you to automatically keep all the copies in sync => all changes you make in the Prefab Asset automatically reflected to the instances
    • you can override settings of special instances from Prefab
    • you can also instantiate game ovjects which where created at runtime and does not exist at the start of the game
  3. Give some examples of situations in which a prefab might be necessary.
    • environmetal assets e.g tree
    • NPCs (non player characters) e.g. the turtle in super mario
    • projectiolse e.g. cannon
    • players character - when it is placed at the beginning of each level in different scenes