Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Create variants from multi-model file?

Discussion in 'Prefabs' started by Flavelius, Dec 24, 2018.

  1. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    558
    Hi,
    i have a .blend file that consists of multiple objects. What i would want, ideally, is to be able to create a variant out of each contained object, so they are separate prefabs that i can modify, with links to their source (a 'variant'), but the editor complains that children of a prefab cannot be deleted, moved and components cannot be reordered. But that's not what i'm attempting.
    Is that a restriction or just not handled yet?

    Edit: if i try to create a variant out of the whole file-model (that contains all the models as pseudo children) i cannot delete objects, only add new ones to it, so that doesn't work either (removing should work the same way as for components, in my opinion).
     
    Last edited: Dec 24, 2018
  2. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    558
  3. MatthieuPr

    MatthieuPr

    Joined:
    May 4, 2017
    Posts:
    53
    When you try to delete children of a prefab, are you in prefab mode or in editor mode? it is no longer possible to remove children of nested prefabs in editor mode.

    open the parent prefab in prefab mode (double click, on it use the white > behind if in scene view or select and press P) and from there you can separate into multiple prefabs.
     
  4. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    558
    I'm in editor mode. I don't want to delete the children, it was just a different route i tried.
    What i want is to create a new variant of the (pseudo) children of a multi-model file. And i actually cannot do what you describe. I cannot open the model file in the prefab-stage (that's only possible for Prefabs) only drag it to the scene. And from there i still cannot create a variant of each model; only if i unpack it first, which is the opposite of what i intend (i want to create a variant, unpacking removes the link).

    Additionally, while it is possible to rightclick each model of the file in the project panel and chose ->create variant, it only creates a variant of the whole model-file, not the part that was selected..
     
  5. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    365
    Hi,

    I am afraid you can't create variants from sub objects in a Prefab only from the complete Prefab.
     
  6. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    558
    But shouldn't this technically be possible, as the models are sub-'assets' (the file (fbx) really just consists of multiple models, not a hierarchy)?
     
  7. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    365
    The model importer creates a single prefab no matter how many sub models you have in your fbx file. It does this by adding a dummy root and making all submodels children of the root.

    The rule for variants is basically that if you can instantiate the model/prefab then you can create a variant from it.
     
  8. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    558
    Looks like i have to create separate files from each model then (cluttering up the project panel quite a bit..).
    But thanks for the explanation!
     
  9. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    365
    Out of curiosity, don't you have to split the model into multiple files anyway in order to be able to use them individually in the scene?
     
  10. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    558
    For simple geometry that doesn't require extra components and has no subhierarchy (small object, like bottles, cups, flowers,etc.), i usually group them into one file. In the past i went with removing the link to the source 'object' by unparenting the pseudo children in the scene and then just duplicated the thus unlinked objects. The mesh link/reference was still maintained of course and that was enough.
    I just hoped, that with the new system this would be improved aswell, allowing more links through variants (renderers, colliders, animators etc).