Unity 5 giving errors on older project: Do not use ReadObjectThreaded on scene objects!

I cannot figure out where this specific error comes from. Because my search on google gives no unity errors as a search result.

I have a older project which i now openend in the new unity version. The result was that the API updater could not update all scripts because of this. Can anyone help me out here?

In case someone else has this error, it seems to happen when LoadAllAssetsAtPath ends up being called on a scene path. This fixed it for me:

public static Object[] LoadAllAssetsAtPath(string assetPath) {
	return typeof(SceneAsset).Equals(AssetDatabase.GetMainAssetTypeAtPath(assetPath)) ?
		// prevent error "Do not use readobjectthreaded on scene objects!"
		new[] { AssetDatabase.LoadMainAssetAtPath(assetPath) } :
		AssetDatabase.LoadAllAssetsAtPath(assetPath);
}

Thanks to Glurth’s answer!

I had this dreaded error. The API updater worked, but unity 5 crashed whenever I tried to build a stand alone build (Windows desktop).

I eventually narrowed it down to meshFilters with a null shared mesh. I had a few MeshFilters with a null shared mesh coupled with a MeshRenderer that had a material in its array of materials. Deleting those objects fixed the issue no more error message and stand alone worked.

I made this script to delete the offending components

[MenuItem( “BuildPlatforms/CI/ShowNullMeshFilters” )]

    static void ShowNullMeshFilters()
    {
        var res = GameObject.FindObjectsOfType<MeshFilter>();
        //dreaded Do not use ReadObjectThreaded on scene objects!
        foreach (var nmo in res)
        {
            if (nmo.sharedMesh == null)
            {
                Debug.LogError("null meshfilter in " + nmo.transform.fullname(), nmo.gameObject);
                Transform t = nmo.transform;
                GameObject.DestroyImmediate(t.GetComponent<MeshRenderer>());
                GameObject.DestroyImmediate(nmo);
                
            }
        }
        res = null;
    }