Search Unity

Updating prefabs when its source mesh has changed?

Discussion in 'Editor & General Support' started by ArachnidAnimal, Apr 12, 2015.

  1. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,835
    I cannot seem to find any solid information regarding this process:

    I have created a Prefab in the Assets/Prefab folder that I created from an existing GameObject.
    I can drag the new prefab into the scene to create a new GameObject fine.
    What I want to do is to update the Prefabs based on any changes to the source mesh.
    Everytime I have to alter the source mesh for some reason I cant figure out how to update the Prefabs without creating new prefabs.

    Every information I find regarding this involves performing a bunch of steps and loop-holes. So I wonder if it is really worth the hassle of creating prefabs if it is possible the source mesh would ever change.

    What is the best approach for doing this?

    Thanks.
     
    chad47 likes this.
  2. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    Actually, changing the prefab that you stored in your Assets folder should result in updated versions in your game.
     
  3. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Changing the mesh should automatically update any prefabs or prefab instances that are using the mesh. The only thing I've found that doesn't automatically update is if you add more (sub) meshes to the mesh.

    Say I have a door model I imported from 3ds max. This model is just one mesh, the door itself. I add this into my scene and I add a rigidbody and hingejoint to it and configure it how I like it. I make a new prefab out of this in my prefabs folder. Any changes I do in 3ds max to this door mesh will automatically be reflected in my prefab.

    But if I go into 3ds max and add another mesh to this model. For instance I want it to consist of both a frame and a door as separate meshes. I overwrite the model in Unity with this updated model. Now the prefab won't automatically update. I think this is because separate (sub) meshes inside Unity are represented as game objects and Unity doesn't want to mess with the hierarchy of your prefab. In this case I just add the new door mesh, which consists as both the door and the frame, to the scene and manually copy the changes I want to my existing prefab. This will trigger Unity to tell me that I'm losing the prefab connection, but as long as I overwrite my existing prefab in the prefabs folder when I'm done making changes to it all my existing prefab instances will be updated and it'll all be good. :)
     
    JoeJoe and ArachnidAnimal like this.
  4. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,835
    I understand what you are saying, BUT getting to the stage of updating the mesh in the prefab is what seems to not be possible. I can update the prefab's mesh's material and shaders as expected, but the issue is changing the MESH based the model changing (i.e. the blender mesh or Maya mesh, ect) is the problem.
     
  5. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,835
    Ok, I will try your approach and let you know how it works. I just seems like it should be more of an automatic process. I will let you know.
     
  6. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    This seems to be a problem that comes with 3ds max, though. I often create submeshes in Blender and after overwriting the .blend file the submeshes are created automatically, too.

    @TTTTTa:
    Do you overwrite your mesh data? I mean, does the updated version of your mesh have the same name as the mesh that has been used before? And is it located in the same folder? Depending on the modeling software you use, it might create duplicates that are named differently.
     
    ArachnidAnimal likes this.
  7. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,835
    I have some screen shots to show what I mean.
    The first screen shot: I created a game obj from the external mesh file (int blender). I then create a pre-fab from it.

    ss1.png

    Then I go into blender and change the location of the text on the original model.
    Screen shot 2 shows the game object created from the source file is updated OK as expected.
    The PF was not. I need to get the PF updated. How do I do this? Ive tried "re-import", revert, apply. There doesnt seem to be an option to do this.
    ss2.png
    How do I get all of the pre-fabs to update?
    Thanks.
     
  8. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    That's what I talked about.

    I don't think Unity wants to mess with your prefabs when you add or change submeshes inside your 3d application. Unless Shushustorm knows of a fix I don't think there is a way. Your problem is exactly what I was talking about.

    As long as you work on 1 mesh so that you only get 1 game object in the hierarchy for your prefab everything will update fine, but when you create multiple sub meshes which Unity creates multiple game objects from it doesn't update your prefab anymore.

    I think this is intentional to avoid ruining your work. Take my door/frame example again.

    Let's say that I inside Unity have modified my prefab so it looks like this:

    Frame (the source mesh from 3ds max)
    - Door (the sub mesh from 3ds max)
    -- Handle (a game object I manually created inside Unity)
    -- Lock (a game object I manually created inside Unity)

    If I later went into 3ds max or Blender and updated the mesh for this object (only frame and door have meshes) I wouldn't want Unity to overwrite my entire prefab and delete Handle and Lock.

    That's at least my take on this.
     
    ArachnidAnimal likes this.
  9. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    To add to my last reply.

    If you don't need your sub meshes to actually move independently inside Unity you can just merge them all into one mesh inside Blender. That way they'll import as one mesh into Unity. To get different colors/materials for each part just use multiple material ids.
     
    ArachnidAnimal likes this.
  10. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,835
    (I was actually trying to reply to YOUR post, but i clicked on the wrong "reply" button, sorry).
    ok, thanks for the explanation. I guess im just going to try to avoid creating the prefabs from now on because it seems they operate differently or are used for a different purpose from what i assumed. it seems just duplicating existing game item is a better approach for me, then i know the meshes will automatically be updated. As far as joining the items in Blender, i think that would cause more headaches inside blender if you have to move things around or re-scale in blender.
    thanks.
     
  11. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    Maybe I understand this wrong? But take a look at the screenshots I uploaded here.
    Updating submeshes from Blender does work. When I add meshes, they will appear and when I delete meshes, they will be gone in Unity. Even updating the material works.
    The only thing that is not imported is the diffuse value. And that's probably because the standard shader doesn't have one.

    screenshots1.jpg
    screenshots2.jpg
    screenshots3.jpg
    screenshots4.jpg
     
    Last edited: Apr 15, 2015
    ArachnidAnimal likes this.
  12. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    @Shushustorm Yeah, that's what I mean with submeshes, but is that the default prefab you get when you drag your model into your scene or a custom prefab? I think TTTTTa says that it works with the default prefab, but not with a custom one.

    I've never actually tried using the default prefab. I will have to test when I get off work if that's feasible or not. My normal workflow is to drag the model into the scene to get a default prefab. Then I add extra game objects to it it, colliders, rigidbody components, scripts, lights etc. And then I take that prefab and create a new custom prefab in my prefabs folder.

    If I later update the mesh my custom prefab won't update correctly.

    Perhaps I'm doing it wrong. Like I said, I will check when I get home.
     
    ArachnidAnimal likes this.
  13. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,835
    maybe that is the approach i need to take. I am new at unity: the problem i had is I had 300 gameobjects in a scene. half of them were just duplicates of non-PFs. The other half were duplicates of Pre-fabs. So only half of them were changing when i updated the blender mesh and I didn't realize what was happening until later.
     
  14. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    @TwiiK:
    I do actually think TTTTTa used a default prefab because the whole prefab is blue. So everything is referencing something. Or are those prefabs supposed to be made of multiple 3d-files?
    But yes, the first thing I do is throwing the .blend into the scene. Afterwards, I am also able to add Unity-objects (in the example below a spotlight) to the prefab and update the mesh in Blender afterwards resulting in an updated prefab in Unity which still contains the Unity object.

    screen.PNG
    Also, in this example the .blend ("test") becomes the main object of the prefab because there is only one object in the .blend.

    Well, you should plan ahead when you want to use prefabs. I don't really know an easy way to replace duplicated objects with prefabs that are created afterwards. You could paste the prefab to the same transform, but that's rather tedious. So basically, if you want an object all over the scene, you should start with a prefab and place the prefabs afterwards. The prefab doesn't have to be finished, of course. Unity just has to know which prefab you are placing where while still allowing you to edit the prefab file whenever you want.
     
    Last edited: Apr 15, 2015
    ArachnidAnimal likes this.
  15. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    @Shushustorm I just tested what you said, but there is no "Apply". Meaning you can't save your Spotlight to your prefab without actually creating a new custom prefab which will not be updated with future mesh changes. So in other words it's not a proper prefab. You can't create instances of it etc.

    Instead of "Apply" you have "Open" which I guess opens the model in Blender if you import a blend file? I only use fbx files so it does nothing. :p

    Edit: But I think nested prefabs is something that's on the roadmap for Unity 5.x if I'm not entirely mistaken. That could be used to solve something like this. The default mesh "prefab" would just be a child inside your custom prefab which housed all the custom Unity stuff.
     
    ArachnidAnimal likes this.
  16. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    I'm pretty sure we are talking past each other, maybe because we use different workflows.
    But I guess I know what you mean now. And yes, you're right. That doesn't seem to work.
    I just tested dragging the in-scene prefab into the assets, which makes the spotlight a prefab, too.
    Then, I could put the .prefab into the scene, but after changing the original mesh, only the original in-scene prefab would update. I guess it's because .prefabs don't look for changes of the referenced meshes?
    Anyway, I don't really see why you would do that. I mean, putting Unity-objects like lights into a prefab of a 3d-model.
    I mean, those objects cannot be batched, right? So there wouldn't be any benefit in terms of performance.
    Also, I don't think anyone would want to build geometry in Unity internal to add polygons to a 3d-file.
    So how do you use it? Or did I misunderstand the whole concept of prefabs and only .prefabs can be batched?
    Because as far as I know, when I use .blends in my scene and duplicate them, those can be batched, too.

    So basically, if I would want to add a light to each mesh of a certain object, I wouldn't create a .prefab, but rather use the .blend as a prefab and add the Unity light to that .blend object in the scene. Then, I can duplicate them all over the scene which allows me to change the in-scene objects when updating the .blend.
    I hope this doesn't get too confusing now :D
    Here is an image that shows how I would approach this:
    screenshot.PNG

    EDIT:
    Alright, I just realized you might want to change the light intensity or color for all the objects. Then, you really should make a prefab of it.
    EDIT2:
    In that case I would make a separate prefab for Unity-objects only and put that .prefab and the .blend under a new parent. Then you can duplicate the new parent while still being able to access all the Unity prefabs and change the geometry. The following screenshot shows what I mean:
    screenshot2.PNG
     
    Last edited: Apr 16, 2015
    ArachnidAnimal likes this.
  17. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,835
    This is why I am not going to use pre-fabs anymore. I think the best approach is to initially create a game object from a pre-fab if you are creating a brand-new scene. Then make changes to the gameObject instance if needed. Then if you need more of them, just duplicate the gameObject now, dont try to re-add the same prefab to the scene. I think this is kind of what how unity intended prefabs to be used: to initially create a single gameobject from a pre-fab for the first time in the scene. . I could be wrong, but there is too much hassle here involved. Also, I found another setback with prefabs: every time you create a gameobject with an attached script from a pre-fab, you have to re-assign public variables to the script via inspector. Whereas, if you create a gameobject instance from the pre-fab, re-assign any public variables in inspector, you can duplicate the gameObject and dont have to worry about re-assigning the variables. But everytime you drag a prefab into a scene, you have to re-assign the script variables. not worth the hassle. pre-fabScripts.png
     
  18. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    I guess you could copy the component values of the script from one of them, select all the other prefabs and paste the values there. So you don't have to set each value of each object individually.
     
    ArachnidAnimal likes this.
  19. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Thanks, Shushustorm.

    I just tried what you said and it worked. You can change your prefab as much as you want as long as you don't change the hierarchy of the mesh object. So just putting the mesh as a child of your prefab like you said works. I just realized that's how all my skinned characters have been setup by default.

    It's very fiddly though. The moment you change something in the mesh hierarchy the connection is broken it seems.

    I'm creating a modular environment for my Ludum Dare game so being able to set up a module with lights, colliders etc. only once, but still being able to iterate on the mesh of it in 3ds max was crucial. :)

    Edit: Suddenly it stopped working. I hope we get better support for this in the future with nested prefabs etc.
     
    Last edited: Apr 19, 2015
    ArachnidAnimal likes this.
  20. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,835
    i just wish that Unity could add some wizard to allow the user to update a prefab and all instances of it based on the latest mesh changes in the hierarchy, if the user wants to do that. I know that would solve all of my problems.
     
    jakejolli likes this.
  21. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    Well yes, you have to know what you’re doing and keep that in mind all the time.
    Messing with the 3d-file's internal hierarchy (inside Unity) will ruin the updating functionality.
    I guess it makes sense because (as far as I know) Unity doesn't change data in the 3d-file, so it has to remember the changes you made to it for the prefab. Then, when you change the original 3d-file's hierarchy, the changes you made in Unity would have different effects than they used to have on the original mesh. I'm afraid that anything different from losing the connection wouldn't make any sense. Unless, of course, if Unity could take a look at the changes that have been made to the 3d-file. Then again, for updating the mesh (hierarchy) like you want it to, some interpretation will probably be needed. So this seems rather risky to me, unless Unity uses some naming conventions that you'd have to stick with.
    Maybe you can regain the connection by restoring the original hierarchy when you accidentally reorder things, though. (I didn’t test it, but it could make sense!)

    You two (and anyone interested in this subject) might also want to check out this thread:
    http://forum.unity3d.com/threads/replace-game-object-with-prefab.24311/
    I haven’t tried the scripts yet, but it seems that replacing an older prefab in the scene with a newer version might also be a handy feature to have.
     
    Last edited: Apr 19, 2015
    ArachnidAnimal likes this.
  22. chad47

    chad47

    Joined:
    Dec 17, 2015
    Posts:
    4
    I had been struggling with this and I think I found a solution. Here are the steps to create a prefab that updates the mesh when you update it in blender:

    1. Drag blender file into assets folder after you have created a new model in blender. (Skip if you already did this)
    2. Drag blender file into the scene hierarchy. This creates a gameobject from the blender file.
    3. Drag the gameobject that you just created back into the assets folder. This creates a prefab, but as we have found, this breaks the link to blender.
    4. On the blender file in the assets folder, click the arrow to open it into it's components.
    5. Drag the mesh component (mine was labeled 'Cube' by default) onto the prefab that was created in step 3. This re-establishes the link with the blender file.
     
    ArachnidAnimal likes this.
  23. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,052
    It should be noted that a 3d model file (blend/fbx/ect) in your project is a Model Prefab, not a normal Prefab. They appear to be similar, but they are not. It really should be treated like any other source asset like texture/material/etc.

    Dragging into scene, then into the project will create a standard prefab with gameobjects/meshfilters/etc. The mesh references in the mesh filters will still be linked to the source, and when the source mesh asset is changed, anything using it will be updated, as it is just pointing to a mesh asset. (like a texture asset).

    You can, however, from an editor script, view and read the contents of Model Prefab as if it were a normal prefab (with the exception that you cant modify it). So depending on your requirements, you can use a little post processing to automate some things. For example, I have a project that is essentially a Lego ship game. I store most of the bricks and their LODs all in a single blender file that I update regularly. When the file changes it triggers a post processor that runs through the Model Prefab and generates new prefabs (or groups) from the many hundreds of parts based on their mesh names. It also sets references in a SO database, to make them available in the various editor tools. So you can do a lot with Model Prefabs, even though you can't edit them directly in Unity itself.
     
    ArachnidAnimal likes this.
  24. MWF

    MWF

    Joined:
    Jan 6, 2017
    Posts:
    1
    I can confirm the issue with 3ds Max exports, and maybe its just .FBX. It sounds like the Blender folks dont run into this issue much, but Ive never used Blender. After exporting with my new mesh in the .FBX, I can see the mesh in the model viewer, but the prefab wont pick up the new mesh, and the story is vice versa if i delete a mesh in max and export that, I still see the mesh in the prefab but not in the mesh hierarchy. The easiest solution I found was to, in Unity:

    -drag the entire updated mesh object onto the prefab. This loses all my material assignments, and I'd imagine it would lose components as well, but I luckily am only dealing with meshes and materials for the most part. If anyone can confirm it loses components, that might be helpful.

    -hook up materials again, and all is well.

    Not exactly a hassle free workflow, but the updating null reference meshes from .fbx has been an issue in other engines I've worked with, so I imagine it is simply a very hard problem to solve.
     
  25. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,835
    This thread is old, but since you already bumped it...

    I completely stopped using prefabs during development. Now, I have a master scene with master gameobjects. If I have an asset which is used in numerous scenes, I put it in the master scene. If I want to add it to a new scene, I open up the master scene, copy the asset from the hierarchy, and paste it in the new scene.
    Prefabs are great to include in asset store purchases to allow the user to easily place the asset in the scene, but they're not best used during development when things can change frequently.
    Think of them as a "snapshot" of an asset at the moment they were created.
     
    Last edited: Jan 7, 2017
  26. 3agle

    3agle

    Joined:
    Jul 9, 2012
    Posts:
    508
    This is the same issue and same solution we currently use.
    It's pretty rubbish frankly, and to me it seems like broken functionality.

    I am curious if using the .3ds file instead of the .fbx export would work around this problem.

    We're using substances via B2M which makes things doubly awkward when we update our models.
    Fortunately we have a decent material replacement editor script that helps make it less fiddly, but it's really something that should be completely avoidable in most cases.
     
  27. eobet

    eobet

    Joined:
    May 2, 2014
    Posts:
    176
    I also came across this bug in Unity 5.6.0f2. Two years old, eh? :p



    For newbies like me encountering this for the first time, when you drag the updated model onto your prefab and you get the warning, just click replace anyway. But unfortunately, all colliders, all scripts and any values you've assigned gets wiped when you do that, which is worse than having to reassign all materials, imo. :(
     
    Last edited: Apr 2, 2017
  28. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    You do not loose materials only, you loose all components and settings if the asset prefab own them before. o_O
    And renaming the meshes in blender or max, cause loose the references to the meshes as well. So they are gone and the prefab has no meshes anymore.:confused:

    An the reason for this is, you cannot use a fbx/max/blender file as a prefab and setup components and materials to it's meshes.

    If unity would be able to, then all problems are gone. But this is one of the biggest issues in unity.

    Edit: I found this here:
    https://www.assetstore.unity3d.com/en/#!/content/70665
     
    Last edited: Jan 3, 2018
  29. 3agle

    3agle

    Joined:
    Jul 9, 2012
    Posts:
    508
  30. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Max 2017, 2018 is not for free. I own a license for 2011 to 2015. Plugins update cost, etc.This mean several thousands $ for a year subscription to run all the stuff is required. It would be for free when it runs out of the box by unity. You can be assured is a money making behavior. And they hide the code by an dll.

    And I pay for my unity pro license too, so I expected a unity integration that does simply update a asset prefab by a referenced imported model file.
     
    Deeeds likes this.
  31. 3agle

    3agle

    Joined:
    Jul 9, 2012
    Posts:
    508
    I understand your situation, but this asset does not require Max (of any year). The prefab handling will work on it's own.
    The requirement listed in the description is for an additional plugin for Autodesk software that allows the 'round trip' workflow part, an optional extra which this thread is not interested in. (Also, it supports Autodesk Maya LT 2017, which I believe is free, or cheap?)
     
  32. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Why I should change my workflow after using 3dsmax since >10 years and changing to a low level Application?
    And it's not save to change to maya anyway, what problems awaiting me here?
     
  33. 3agle

    3agle

    Joined:
    Jul 9, 2012
    Posts:
    508
    I don't think you are completely understanding the features that this asset brings.
    Your workflow does not need to change if all you need is mesh changes trickling to prefabs.
    There are many different features this asset gives, ability to do a round trip workflow is an optional one (and an industry driven decision).

    You are perfectly free to not use this asset, or to complain to Unity on their feedback page, however I advise using it and seeing how it works.
     
  34. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I have this same problem with prefabs all the time, and it's not the result of modifying a mesh inside Unity or changing something in the object's hierarchy. It seems what breaks the prefab from the imported model is adding colliders, adding scripts, hiding/showing children, or some combination after the prefab has been added to the scene. This happens to me all the time. I spend lots of time setting up the object with colliders and scripts and such, then I go back (to Cheetah3D) and change something minor, like a material or a UV map, or a rotation, and when the model is reimported, the prefab does not update. Then I have to add the new model to the scene and set it up all over again. This gets especially time consuming when I have to change a bunch of models all at once. Is there any way to get the prefab to update when only minor changes are made outside Unity?
     
  35. mlglock

    mlglock

    Joined:
    Jun 2, 2017
    Posts:
    1
    I am facing the same issue and I cannot believe it exists since 2011. What is the recommended prodecure to do something as simple as this:

    1. Create a cube in Blender and export it as .blend into your asset folder
    2. In Unity, drag the imported cube into the hierarchy
    3. Make a change, for example adding a Box Collider, and drag the hierarchy object into your asset prefab folder
    4. Now if you make changes to the Blender file (changing dimensions for example), neither the prefab nor the hierarchy object is updated

    If I do not create a prefab from the hierarchy object, the object is correctly updated. My understanding is that the hierarchy object keeps the reference to the blender file in this case. By making a prefab, the hierarchy object then references the prefab and not the blender file.
     
  36. eobet

    eobet

    Joined:
    May 2, 2014
    Posts:
    176
    I don't see any official Unity response in this thread, which I find weird.

    Weirder still, why isn't this thread 200 pages long? It seems as if this should be something affecting 100% of users, and daily throughout the development on top that!

    Either something is fundamentally wrong with Unity, or everyone in this thread has fundamentally misunderstood something.
     
    Deeeds likes this.
  37. Deleted User

    Deleted User

    Guest

    I see the same issue with a character. I have a skinned character added to a prefab with a bunch of scripts. In Maya, I update the mesh with new topology. Reimporting the fbx in Unity and the skinning information still reflects the old topology so the vertices are scrambled.
     
  38. Deleted User

    Deleted User

    Guest

    Ran into something similar.

    There should be at least a 'sanity check' on the Prefab after importing a changed model (FBX).
    It doesn't matter if it's hierarchy changes, materials, extra geo etc.
    If the Prefab is affected by the newly imported FBX, you should at least get a warning.

    Now... not so much...
     
    Deeeds likes this.
  39. DChap

    DChap

    Joined:
    Dec 24, 2016
    Posts:
    23
    I always feel like I need a sanity check when running through my art pipeline to Unity.

    I'm also seeing that issue @cvernon is seeing (character prefab has broken skinning when updating the mesh FBX). This is the type of thing where I definitely feel like I am lacking some fundamental knowledge of Unity's intended workflow because as has been said (@eobet), why isn't EVERYONE posting here with the same problem?

    For the record, I use 3DS Max, so maybe the pipeline works more smoothly with Maya or Blender?
     
    Deeeds and eobet like this.
  40. eobet

    eobet

    Joined:
    May 2, 2014
    Posts:
    176
    I'm on Blender, so no, it's a deeper issue than that.

    Though, unfortunately, it seems not even "nested prefabs" will fix it, as the people who know don't see it as an issue:

    https://forum.unity.com/threads/nested-prefabs-is-shipping-in-2018.502129/#post-3475853

    Nobody has still managed to convince me that this isn't a critical flaw, but maybe it will click some day.

    I also posted here, but again, it's so weird that nobody seems to care:

    https://forum.unity.com/threads/official-share-your-prefab-workflows.476630/page-2#post-3485282

    Right now, I suspect that ours is a use-case the developers didn't design for, and sadly won't re-design either as from their end, it's "working as intended", despite the fact that users finding new ways to work with designs should be an integral part in any ongoing development (guess I just read so much Donald Norman that I refuse to see what I do as "user error").
     
    Deeeds likes this.
  41. eobet

    eobet

    Joined:
    May 2, 2014
    Posts:
    176
    Nested prefabs does appear to finally fix this:



    It's not super apparent to me (since I haven't tested it yet), how this is actually activated, since it still doesn't appear to be a completely transparent behavior (which it should be). It seems you have to create a "prefab variant" before you do your first edit of the imported model, and then never use the model directly, but always use the variant.
     
    Last edited: Jul 10, 2018
    DChap likes this.
  42. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    the root of this problem might be that prefabs assign a fixed length, immutable array for the vertices of a model, and becomes reliant on that array being as-it-was at prefab creation. Anything breaking/changing that array (an updated model) might then cause the prefab to dissolve all those things it (wrongly) considered to be reliant upon the integrity of that array.

    Just a guess.
     
  43. LuckyLuke1976

    LuckyLuke1976

    Joined:
    May 24, 2018
    Posts:
    2
    Hi, someone have find a solution?
     
  44. Brit1974

    Brit1974

    Joined:
    Feb 5, 2018
    Posts:
    3
    So - I think I might've stumbled onto a solution for this. Here's what you need to do:

    - Export your model to an fbs file.
    - Grab the model ("MyModelExport") and drag it into the scene hierarchy. It'll appear at location 0,0,0.
    - Now, create an empty object and drag the model ("MyModelExport") into the empty object (we'll call the empty object "MyGameObject").
    - Now drag the top-level object ("MyGameObject") into the prefabs. If you open-up the prefab object, it should look like this (pay attention to the icon next to the "MyModelExport" item - it should be blue with a little paper icon next to it, showing it's a reference to a model):
    MyGameObject.PNG

    Now, whenever you update the "MyModelExport" it will show up in the prefab and all your world objects.
     
    Last edited: Jul 21, 2019
  45. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    150
    +1
    Using a Model Gameobject as a root for a prefab will break any changes made to the mesh..... Damn it sucks figuring this out half way through a big project...
     
    DChap likes this.
  46. toonlets

    toonlets

    Joined:
    Apr 3, 2021
    Posts:
    11
    Is this still a topic of discussion, because here is how I deal with it...

    I modeled a computer control panel, brought it into Unity, made a prefab out of it, and assigned materials. Only then did I realize I wanted to change the model. If I edit and save the original, the model on disk changes, and the original import in Unity changes, but the prefab remains unchanged.

    What I did was I selected the prefab to edit it. Inside there, I deleted all the pieces. I then dragged in my updated geometry. I had to completely unpack it inside the prefab, but the result is an updated prefab using the new, updated geo that's saved on disk.