Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Updating FBX breaks prefabs! Isn't this a big problem?!

Discussion in 'Editor & General Support' started by imtrobin, Sep 6, 2011.

  1. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Hi

    I have semi complicated prefabs setup, and I found if I update the fbx, the prefab and mesh link got broken, and I have to rebuild the prefab from scratch again. I looked at various solutions like Merlin Prefab Lab, but it seems they don't support characters.

    Isn't this a big problem?! How can we use unity for large scenes if the prefabs keeps getting broken with art updates?
     
  2. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    I've never seen that happen. Maybe you are aplying changes to an instance of the FBX model itself and it is not good practice.
    You should parent your FBX into something else, maybe an empty gameObject and use that as your character where all the engine stuff goes onto, not the mesh itself.
     
  3. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
  4. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    +1, we've been running into this issue for some time now :-(
     
    Nanako likes this.
  5. Yorick2

    Yorick2

    Joined:
    Jan 24, 2009
    Posts:
    297
    This can happen in so many cases.

    For example when you want to parent particles to your models or when you want to upgrade mockup art to the real thing.

    This is the reason we created Merlin's prefab lab.

    It's not perfect but saves us a lot of time anyway.

    @imtrobin: Have you been in contact with anybody here at Paladin Studios? Maybe we can work together to improve the character support.
     
  6. giyomu

    giyomu

    Joined:
    Oct 6, 2008
    Posts:
    1,094
    as bruno xavier said, a generally safe solution is never put anything on the model itself, or at last just keep the anim component and other basic that come , skin renderer mat etc, and use an empty node master to put all your script on their own node, you can even make various node , to handle Ai etc etc...

    with that no matter if you update the mesh all other part of your stuff will remain intact...and if you instantiate the model at run time from thos empty you can even drop any model you want and use same fonctionnalities with problem :)

    oh and usually those prefab issue often happens when you get a skinned mesh and update it bones hierarchy , I never really had such trouble for non animated model
     
    Last edited: Sep 13, 2011
  7. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    @giyomu, thanks for the suggestions, we've been doing much of that thus far. Its the issue with the skinned mesh render and the bones refresh issue thats getting tiresome fixing over and over. We've having to move nearly everything into separate gameobject that load any relevant bone hierarchy references on awake or start. annoying, but at least a solution.
     
  8. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    My situation is more annoying, as my scripts takes in specific bones, so they get set to null. Putting on a separate gameObject will not help.

    Hi Yorick, I read from your documentation that Merlin prefab does not support skinned mesh. I will PM you my email
     
  9. giyomu

    giyomu

    Joined:
    Oct 6, 2008
    Posts:
    1,094
    well you could lookup for your bones at first, and collect their ref, on some project i need to catch up some locator bone as well, and i usually hook all that in first place from a separate object, of course if your bones name change from previously, but you could make you a simple helper script to catch given bones on the model and store them in array or list so you can get access to them...

    so even using a separate object should not be a problem...
     
  10. TedBrown

    TedBrown

    Joined:
    Aug 6, 2011
    Posts:
    16
    Same issue: right now, we have a character model created in Blender with Actions. Those actions show up in Unity and animate correctly. However, if we update the FBX, the prefab is not updated, forcing us to trash it and recreate it.

    I wonder if this is something that could be addressed through the use of external animation files, the ones that look like "character@walk", for example.

    I'll look into it.
     
  11. TedBrown

    TedBrown

    Joined:
    Aug 6, 2011
    Posts:
    16
    Here are the results. They are positive, but there are caveats. I love Unity, but if this was a custom engine tool at a company I was working at, I'd be all over the tool engineers until this was fixed.

    Summary: We will stop using Actions in Blender immediately, and move to discrete animation files using the "character@animationname" format.

    This has the following implications:

    1. Exporting an updated animation has the intended effect, i.e. the animation is updated in Unity. This does not happen with Actions, AFAIK.

    2. You do not have to re-create the prefab when adding a new animation. HOWEVER: You must manually increase the size of the animation array of the prefab, and select the new animation clip. It is not automatic (like it should be).

    3. I believe the size of the project is going to get incredibly BLOATED, because each FBX not only has the animation data, but the mesh, skin, material, UVs, etc. as well! (If you know of a way around this, please let me know)

    I absolutely do not want to go down this route, but it's more artist friendly. Maybe when the animations are final, we can pull everything into a single Blender file with defined actions. *shudder*
     
  12. giyomu

    giyomu

    Joined:
    Oct 6, 2008
    Posts:
    1,094
    for 3 , why it will oncrease size ?

    going to this approach you just import your sknned mesh without animation once, and then export after only animation itself, the difference in term of size with a mesh and one full unique is minimal, plus it very flexible to deal with individual animation clip, specially when you tweak some..

    for the anim components, well you coul make you a little editor tool to re update this in one click :)
     
  13. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    We too have move to using blender in our recent iOS projects, and have found this lack of PROPER native updating support for skinnedMeshPrefabs to be quite disappointing. how is this not a big issue with other developers.

    Yes there are workarounds, some "mostly work", but IMO there should be NO need for a workaround for this core functionality. That being said, we're using awake/start calls to fill all of our bone references, annoying/should be unnecessary, but works.... HOWEVER what doesnt work is the AnimiationEvent(send message) calls that cannot call in certain "directions/up/down" in the hierarchy, this means we DO have to reattach our components with AnimationEvent calls(being dynamically placed on premade/exported/fbx ACTIONS) each time we replace the prefab. This is a time waster, and an example of the need to FIX this issue. You cant place animationEvent calls on a parent Empty object, and call down the hierarchy to the skinnedMeshRenderer that NEEDS to house the scripts calling AnimationEvents(send messages) to be assigned to those very animation clips on the skinnedMeshRenderer.... unless of course you know a way around this(totally unnecessary runaround, come on Unity :-(
     
  14. TedBrown

    TedBrown

    Joined:
    Aug 6, 2011
    Posts:
    16
    If I understand what you're saying, there's a way to export just the animation data from Blender, and not the entire object, etc? Makes sense, I'll look into it.

    The other thing I'm wondering is if the distributable package will only take the animation data from the FBX file. That would solve the bloat problem once the application is packaged for distro. Hypothetical at this point, but still.

    The bigger issue (which our artist identified) is that any change to the skeleton must be propagated to each animation file. That's a chore, and a fault risk. But, well, as they say in some circles, 'ere we go!
     
  15. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    I write the scripts without hardcoding bone names, so they can be reused for different characters. I set the bones in the inspector.

    This is quite a deal breaker for using Unity for large projects. Imagine I have a lot of skinned mesh prefab instances in many scenes, I have to recreate every instance in every scene when the prefab breaks.
     
  16. giyomu

    giyomu

    Joined:
    Oct 6, 2008
    Posts:
    1,094
    well i know that prefab in some circumstance are hard to deal with, but working with an artist how modify a lot animation or bone structure, we came up with some workflow, either him from mel script or me with some editor tool, or some convention between us about naming etc...

    so i think when you start to get in those situation , it may be worth the time to dig into editor code in unity and see if you can ease your life on some aspect...

    tho yes will be good to not have to think about this yourself, but this where editor class in unity become your best friend :)
     
  17. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,183
    Can you please raise a bug about this with a small test project and detailed step by step instructions on how to reproduce this and paste the bug # here?

    Thanks.
     
  18. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,132
    This is one of my biggest issues with Unity. I always used to receive a new skinned mesh fbx from an artist and then have to relink all the bones sub-meshes to my script component as the links would be lost. Also any custom material changes I had made would get lost too.
    In the end I modified my script to find all the required bones and materials by name and setup the links in the script init. But this makes the visual linking redundant.
    I have not tried this recently so don't know if it works any better yet.
     
  19. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    What, to me, is definitely a bug, or at the least, the lack of a CORE features, one that cant trivially be worked around, is the dynamic event calling, using sendMessage. Anyone adding AnimationEvents at runtime has likely experienced the NEED to have the animationEvent being added to the very object with the animation component housing those animation clips the events are being set on(whew ;-). Thus, needing to add this component again each time an FBX is updated, and losing all editor reference links previously set(yes we've moved ALL manual reference linking to code now, but still need to manually re-add the script each time the FBX is updated.

    Having to reattach this script every time an FBX that has a rig is reImported is very redundant; especially given that we have many actors in this particular project with rigs, that all call for this process each time our artists commit a new FBX, ugh.
     
  20. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,183
    Please raise a bug report with detailed repro steps and give me the bug number. Either via pm or in this thread.
     
  21. vagalume

    vagalume

    Joined:
    Sep 26, 2014
    Posts:
    3
    I am new to Unity but I've just have the same problem (lost skinning on Prefab after importing a FBX file).
    I've solved it creating a new avatar per animation file , instead of " copy from other Avatar at the scene ." These attributes can be found on the FBX Import Settings.
    Hope it helps
     
  22. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    i don't know anything about this issue, but it sounds like something that will eventually be relevant to my interests. bookmarking it and that prefab lab thingy too
     
  23. sreedhar3d

    sreedhar3d

    Joined:
    Aug 13, 2012
    Posts:
    6
    This is not a Unity issue,

    The first Fbx when you export that should be clean (Optimized and delete BindPose in Maya)

    and next time you need to use the same maya file and update any model change do the same (Optimized and delete BindPose in Maya). Then your prefab works fine.
     
  24. Pixeldamage

    Pixeldamage

    Joined:
    Sep 6, 2010
    Posts:
    52
    This is definitely a Unity issue and according to this developer it's to do with the prefabs only referencing bone indices (http://forum.unity3d.com/threads/prefab-breaks-on-mesh-update.282184/). Throughout the past two years of production on our game it's been a real pain and so much so that we have an in house tool to regenerate the prefabs everytime the fbx is updated.
     
  25. joaobsneto

    joaobsneto

    Joined:
    Dec 10, 2009
    Posts:
    152
    Are there no solutions so far?
     
  26. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    687