Hi!
Wanted to see if anyone else encountered the same and hopefully found a workaround.
Unity 2018 (Unity 2018.3.0f2, 2018.3.2f1) reproducable broke our asset import.
-
Delete /Library, /Obj (and whatever other temp folders you have)
-
Open the project (does not matter if via hub or command line)
-
Wait until import is done
-
Prefab state is incorrect
-
References to most ScriptableObject *.asset are null
-
This breaks many of our tests and obviously play mode as well
-
Project/*.asmdef/Test state is incorrect
-
No tests are detected - the window shows 0 tests (playmode & editor)
-
This causes running tests from the command line to always succeed. No tests found => no failed test.
And this is our manual workaround, but this is not something I was able to integrate into our CI/CD workflow
- Search t: prefab
- Select All
- Reimport
- Search t:script
- Select All
- Reimport
- If tests show, continue. Otherwise go to 4.
- Run tests
- If tests fail because references to *.assets are null repeat 1. to 3. and go to 8. otherwise done.
Can you provide steps to reproduce on a new/empty project? And the first step in the bug report is “provide a cloud space”, can you elaborate? Does this reproduce locally?
@JeffDUnity3D I’d like to upload the large project and we usually get a password protected cloudspace to upload the project in such cases. The unity uploader takes forever with our project aand always crashes on zip compression or upload step. That is why I for this particular project I always request the cloud space and usually get one provided
This reproduces on every of our teams developer machines locally.
I might try to create a MRE - but not before mid februar. We are really under pressure at the moment and as much as I wished to help out earlier, there is not the time right now.
Not your full project, a minimum project that reproduces the issue. Otherwise it will likely not be looked at any time soon.
As said, I wished I could help you out earlier - but we simply do not have time for that at the moment.
I opened the thread to see how many others have run into this, to see if this is a project specific issue or a bug affecting a wide range of users. We might try to strip it down in mid Februar.
Got it, so it’s a lower priority for you, just checking.
1 Like
[mention|FoT1X6hnMLAUmFLAiyG1NQ==] Lower than the broken Lightmaps in Addressable Asset which block our release? Yes
Again, same suggestion, not your big project, but a MRE (I have no idea what that means, hopefully “minimally reproducible something”). And not the steps that YOU take to reproduce in your project, but the minimal steps that someone else would need to take in a new/empty project. This ALWAYS speeds up resolution.
1 Like
Perfect! Yes, one of those would help.
Was not able to reproduce it in a new project yet. Will have to invest more time slowly porting part by part of the other project to the reproduceable project to see when and how it starts to break
[MenuItem("Fix Assets")]
public static void FixBrokenAssets()
{
var paths = AssetDatabase.GetAllAssetPaths().Where(p => !IgnoreAssets(p));
var pathArray = paths as string[] ?? paths.ToArray();
var scripts = pathArray.Where(IsScript);
var scriptableObject = pathArray.Where(IsScriptableObject);
var prefabs = pathArray.Where(IsPrefab);
var asmdef = pathArray.Where(IsAsmdef);
foreach (var path in scripts)
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
foreach (var path in scriptableObject)
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
foreach (var path in prefabs)
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
foreach (var path in asmdef)
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
}
private static bool IgnoreAssets(string path) =>
string.IsNullOrEmpty(path) || path.StartsWith("Packages") || path.StartsWith("ProjectSettings");
private static bool IsScript(string path) => path.EndsWith(".cs");
private static bool IsScriptableObject(string path) => path.EndsWith(".asset");
private static bool IsPrefab(string path) => path.EndsWith(".prefab");
private static bool IsAsmdef(string path) => path.EndsWith(".asmdef");
This obviously is a horrible solution and increases the time each CI configuration takes by one order of magnitude for us (except actual building a player obviously) but it at least it DOES fix the problem temporarily. I need to see if this fix is table or if batchmode exits before it is done - what I actually fear because I am pretty sure it does so before recompilation.
Edit: Updated the order of imports as scripts and scriptable objects have to be reimported before prefabs using them to fix the prefabs and the asmdef has to be reimported to find the tests after the scripts have been reimported.
Edit2: Added missing helper methods.
@JeffDUnity3D we got the mail, that the bug was reproduced (Case 1122461)
and sent to the developers. Is there any known fixed in version yet? This still heavily hinders us in Unity 2018.3.12f1 which was just released and makes a reliable build impossible.
In essence: Since months this bug breaks our CI/CD pipeline as the only way to reliable get a build which does not run into this bug is to manually reimport in the correct order (script, scriptableobjects, prefabs) and wait long enough until unity has stopped any processing between each step. Even the script above does not work reliably and I assume the reason is because there are likely a lot of timing issues (Unity does a lot of stuff when you reimport, e.g. recompilation starts to trigger and I assume unless it is completly done with all operations the bug persists)