Search Unity

Creating a 'new' and empty Prefab

Discussion in 'Getting Started' started by TheeKennyMcB, Dec 19, 2018.

  1. TheeKennyMcB

    TheeKennyMcB

    Joined:
    Dec 16, 2018
    Posts:
    7
    Hi! I'm new to unity!
    I'm a 3D artist, and I'm slowly learning the environment.

    I understand what a Prefab essentially is. Currently I'm only able to drag an object from my Hierarchy to my Asset folder to convert it into a Prefab.

    I would like to go to Asset>Create>Prefab
    This doesn't seem to exist.

    Is there not a way to simply create an empty Prefab and add to it without starting from a Parent Object.
    I thought of doing this with an Empty Game Object, but it still treats the game object as the Parent in the Prefab.

    I've looked around the web, read some forums, and watched videos.
    Still searching, so I came here.
    Currently using 2018.3.of2

    Thanks,
    Kenny
     
  2. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    Welcome to the forums!

    What would an empty prefab look like, in your mind? GameObjects are the core element in Unity. If something can exist in a scene, it's a GameObject.

    How, more specifically, do you need it to function when creating a prefab?
     
    Ryiah and JoeStrout like this.
  3. TheeKennyMcB

    TheeKennyMcB

    Joined:
    Dec 16, 2018
    Posts:
    7
    Hey! Thank you for your response!

    Since I'm learning from the ground up, I'm trying to understand the logic of the software and how to go about things in a clean way.

    A prefab to me is a micro-scene that stands alone. It's an asset, like a scene, or a mesh, or an animation.
    You can spawn it as a Game Object, much like a mesh.

    But ultimately it's a empty asset that can host any number of assets or game object to be spawned into a scene.
    Scenes, meshes, animations are not GameObject or Prefabs. Unless they're spawned in the unity scene.

    When working in a 3D modeling software like Max or Maya, it's similar to when you have a 3D scene file with a rigged character in it. But you then can spawn an instance of that scene into another scene to actually animate it.
    That way if you update the rig it will do it to all scenes with animation that use that rig.

    I bring this up, because some tutorials I've seen (much older) had the option to
    Asset>Create>Prefab
    That doesn't seem to exist anymore.
     
  4. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    That's all a GameObject really is, though.

    When you create a new GameObject and view it in the Inspector, you can see that it has only one component: Transform. The Transform component simply keeps track of position, rotation, and scale. It's not until you add additional components or nest other objects as children that a GameObject gets more complicated.

    Picture your "empty asset" you described. When you instantiate it into a scene, you'll want to dictate where it sits, and how it's oriented, right? That's what the Transform component does for you! If your empty asset didn't have a Transform, the engine would have no clue what to do with your prefab instance, so why would you ever not have it?

    I don't know exactly when the menus were changed, but I'm fairly certain that even in the days when it was an option to create a Prefab from the context menu, it still just created a GameObject with a default Transform component applied.

    Anyway, you shouldn't get too hung up on this. Just trust me that a brand new GameObject is as empty an object as you'd ever want in Unity*.

    * - Unless you're talking straight up data structures, but I'm sure that's not the direction you're going with this
     
  5. TheeKennyMcB

    TheeKennyMcB

    Joined:
    Dec 16, 2018
    Posts:
    7
    Thanks again for your reply!

    I'm currently doing simple tutorials to get basic interactions between objects.
    When I stumbled upon Prefabs my imagination exploded with the possibilities.

    Coming from a 3D art background and using a lot of various software, I just wanted to make sure I was approaching the process in a non destructive way.

    It sounds like I will soon worship the Game Object! Haha!
    I have a lot more confidence moving forward!

    Thank you!
     
  6. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    No problem. It'll take some time, but the more you work with Unity (or even just game engines in general, I'd say), the more sense it'll make. Keep at it!
     
  7. Ziplock9000

    Ziplock9000

    Joined:
    Jan 26, 2016
    Posts:
    360
    There's logic in the question especially with the new nested prefabs.

    For example I have nested prefabs for buildings that I place on terrains.

    When I make a new building I'd like to make it in "prefab mode" with a completely empty view so I can start placing objects. I don't want to start building it on the terrain that is bumpy, with grass and trees in the way, lights and FX that I need to turn on and off and then convert to a prefab.
    I don't want to have to select and manually hide those obstructions and unhide them when I'm finished.
    Instead I'd like to create a new empty prefab and jump directly into prefab mode.
    Or jump directly into prefab mode and it ask me if I'd like to save if I do something.
     
  8. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512


    I mean, sure. I can see how that would save you a step or two. But of all the critiques I'd offer of the new nested prefab system, not being able to skip steps 1 and 2 to get an empty prefab isn't high on the list of things I'd want to see handled. :p
     
  9. TheeKennyMcB

    TheeKennyMcB

    Joined:
    Dec 16, 2018
    Posts:
    7
    This is a perfect example of what I meant.

    If this were 3DsMax - It would be like creating a scene - then creating another scene within the scene to start modeling.
    I like the idea of being able to enter Prefab mode independent of the scene to create and edit a prefab before it has ever been placed in a scene.

    I understand Unity is constantly being developed and added on, so it's interesting to think of features not being as important as others in one's opinion.

    A friend jokingly compared Unity to zBrush. If you've ever used zBrush, it's like a 3D modeling software for sculpting, but without much of the natural workflow logic of many 3D softwares. Nothing makes sense until you learn the software with its unique quirks.

    I'm enjoying the conversation. Thanks for the replies!
    -Kenny
     
  10. Ziplock9000

    Ziplock9000

    Joined:
    Jan 26, 2016
    Posts:
    360
    In a complicated scene for a real production game it saves far more than a step or two and more importantly avoids user error, thus a very easy thing to add to Unity for a huge gains to the game developer. This isn't a thread about selectively picking criquies and nobody said it's a high priority. :)
     
  11. marlin_fabervisio

    marlin_fabervisio

    Joined:
    Jan 8, 2020
    Posts:
    4
    I would also love to see the feature of creating a prefab directly without having to add it as an gameobject to the Scene first.

    A simple workaround for the issue, that can save you a little bit of time is preparing an empty prefab once and whenever you want to create a new just duplicate (Ctrl+D) it.