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

4.6.1 Broke Prefab Saving and Model Scaling

Discussion in 'Editor & General Support' started by eshan-mathur, Dec 11, 2014.

  1. eshan-mathur

    eshan-mathur

    Joined:
    Nov 22, 2011
    Posts:
    118
    I can't think of why there wouldn't be many many threads about this unless it was only affecting our project, but the weird bit is that we have two projects running separately and they are both having the issue.

    No one on my team that has upgraded to 4.6.1 can save prefabs anymore (i.e. the changes don't show up in Git at all) and neither can they change the Scale option in the model import settings for a .FBX. It's locked to 0.01 (not greyed out, but just reverts immediately after defocusing the float field).

    Is anyone else having this issue or know of a workaround? I'm concerned that Unity won't release a patch fix for it if we're the only ones experiencing this.
     
    Jeffreye likes this.
  2. vaclav_b

    vaclav_b

    Joined:
    Jun 7, 2013
    Posts:
    16
    We are having the same issues but it also affects scenes saving. It worked just fine in 4.6.
     
    Last edited: Dec 12, 2014
  3. Ricks

    Ricks

    Joined:
    Jun 17, 2010
    Posts:
    650
    Gaaaaaa... seriously? Just stopped the 4.6.1 download...

    @vaclav_b : I assume you meant it worked fine in 4.6.0.1 (not 4.6.1)?
     
  4. Zemos-Waltan

    Zemos-Waltan

    Joined:
    May 12, 2014
    Posts:
    1
    I have the same issue in 4.6.1
    Project was warking perfectly in 4.5.5p5 but now i can't save any changes.
     
  5. vaclav_b

    vaclav_b

    Joined:
    Jun 7, 2013
    Posts:
    16
    Yeah I Edited my post.

    Also I think I found the culprit, seems like ex2d is causing the issues for us.
     
  6. Aurore

    Aurore

    Director of Real-Time Learning Unity Technologies

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    Has anyone created a bug report for this? If so please post the bug number.
     
  7. eshan-mathur

    eshan-mathur

    Joined:
    Nov 22, 2011
    Posts:
    118
    Last edited: Dec 12, 2014
  8. FlatfishGames

    FlatfishGames

    Joined:
    Jan 11, 2014
    Posts:
    3
    We have the same problems, except we can save prefabs. The import settings can't be changed at all, and the scene saving doesn't work. Other older projects work normal in 4.6.1
     
  9. wuzibu

    wuzibu

    Joined:
    Dec 15, 2014
    Posts:
    10
    We got the same problem within our project.
     
  10. Aurore

    Aurore

    Director of Real-Time Learning Unity Technologies

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    Bug number will be sent to you by e-mail, but that link is fine.
     
  11. eshan-mathur

    eshan-mathur

    Joined:
    Nov 22, 2011
    Posts:
    118
    I don't see the bug in the issue tracker - what's the right way to follow this and get support for it?
     
  12. PrefabEvolution

    PrefabEvolution

    Joined:
    Mar 27, 2014
    Posts:
    225
    This is not a Unity bug. This happens because UT fix OnWillSaveAssets method. This means that before you can declare it with Void return type and it will save all assets, now it should return paths that should be saved. So if you have this method that have viod return type or this method returns null Unity will not save your assets. To fix it just look for this method and fix it like that:
    Code (csharp):
    1.  
    2. static string[] OnWillSaveAssets(string[] paths) //Should return string[]
    3.   {
    4.   //your code here
    5.   return paths; // return filepaths that should be saved
    6.   }
    7.  
    this behaviour detected form 4.6.0p1 and you can see in release notes:
    • (638865) - Editor: Fixed AssetModificationProcessor.OnWillSaveAssets checking out files that were not Saved and OnWillDeleteAssets always marking assets for delete.
     
  13. eshan-mathur

    eshan-mathur

    Joined:
    Nov 22, 2011
    Posts:
    118
    Hm, my underlying tools framework may be using something like that. I'm not seeing any references to that specific function in our project; do you know if there are other functions that perform something similar?
     
  14. PrefabEvolution

    PrefabEvolution

    Joined:
    Mar 27, 2014
    Posts:
    225
    So possible that this function used inside some dll that you are use, its time to check for updates:)
     
  15. eshan-mathur

    eshan-mathur

    Joined:
    Nov 22, 2011
    Posts:
    118
    @PrefabEvolution was on the money. Fabric was using the old version of that function and causing our asset saving to break.

    Fabric's developer has been contacted and they are releasing a patch very soon.
     
  16. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    Whether or not this is a bug can be discusses, but it is certainly breaking behavior which should not happen in a minor release.

    The fix in OnWillSaveAssets is valid but it used to be OK to return null because you simply don't want to modify the list of assets.

    I will talk to the engineer who made the chance to know if he had a reason and get the behavior reverted.


     
  17. PrefabEvolution

    PrefabEvolution

    Joined:
    Mar 27, 2014
    Posts:
    225
    This happenns because Unity doesn't verify method signature when calling methods like this. In docs this method declarad with string[] return type and guys that use this method with wrong signature now fails, but it would be better if Unity can check method signature before calling method and throw an error.

    Or you probably should use explicit method declaration regardles to unpredicable reflection method invocations
     
  18. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    We actually do check the signature of the methods in AssetModificationProcessor, but in the case of OnWillSaveAssets the return type is ignored. I don't exactly remember why I chose to ignore the return type on this, but probably becuase some asset store packages broke.

    Even if we did add a check for the return type that would still not prevent the user from returning null and we should handled that gracefully at least with a warning that your scene was not saved.

    But in some cases the user does not have to source code of the plugin but only a compiled DLL, so even if the user gets the warning he can't fix it and the only way for him to save a scene again would be to remove the plugin.
     
  19. PrefabEvolution

    PrefabEvolution

    Joined:
    Mar 27, 2014
    Posts:
    225
    I mean that you should do that long time ago, so that guys who don't want to do things proper or read docs should get a lot of warning messages in console. You probably should expose thing like that in different way. In this example user have very big error prone. If you can make AssetModificationProcessor abstract with methods that user can override, you will force them to do it right. And on invocation you just instantiate all classes that derived from AssetModificationProcessor cache them at some list and invoke method directly without any reflection that 5 times slower than direct virtual method call.
     
  20. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    Yes but even if we do that, the user can still return null, which we still have to handle.
     
  21. PrefabEvolution

    PrefabEvolution

    Joined:
    Mar 27, 2014
    Posts:
    225
    Just:
    Code (csharp):
    1.  
    2. foreach(var assetModificationProcessor in assetModificationProcessors)
    3. paths = assetModificationProcessor.OnWillSaveAssets(paths) ?? paths;
    4.  
     
  22. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    I had the same problem few days ago (on 12th of December) updating from 4.6.0 to 4.6.1p1.
    I was not able to save any scene or prefabs changes.
    This is the bug number: 655637
     
  23. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    Yes exactly, which is pretty much what was done in 4.6, but in 4.6.1 the check for null was removed and null was simply assigned to 'paths' which means Unity thought there was nothing, not even the scene, to save.
     
  24. wuzibu

    wuzibu

    Joined:
    Dec 15, 2014
    Posts:
    10
    nonetheless, thanks for finding the reason. we could fix it in our project.
     
  25. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    The last patch resolved the problem for us, but my bug number is still open and I don't know if there is a way to close it by myself.
     
  26. eshan-mathur

    eshan-mathur

    Joined:
    Nov 22, 2011
    Posts:
    118
    So can we expect that in 4.6.1p3 (Jan. 8th?)
     
  27. BMayne

    BMayne

    Joined:
    Aug 4, 2014
    Posts:
    186
    I am very thankful for this thread, it was killing us. I just switched the code to return the same string and everything worked.
     
  28. directedchaos

    directedchaos

    Joined:
    Dec 22, 2012
    Posts:
    14
    Ouch that's painful. Looks like the latest patch (p3) fixes the saving issues (scenes and prefabs -- neither were saving for me, though for scenes save as to a new file was working, and for prefabs creating a new one worked, but that got confusing really quickly).