After analyzing the problem, I found:
- During the build through ECS 0.3.0, all SubScenes are packaged and stored in Steaming Assets.
- After starting the application, the ResolveSceneReferenceSystem finds all requested SubScenes and creates the necessary Entities
But there is a problem with reading this data on Android due to the inability to work with Steaming Assets through File.Exists / File.Open
References to problems:
- File.Exists(sceneHeaderPath) //ResolveSceneReferenceSystem.cs:121
- File.Open(fileName, FileMode.Open, FileAccess.Read) //BinarySerialization.cs:99
Problems part:
In EntityScenesPaths:
public static string GetLoadPath(Hash128 sceneGUID, PathType type, int sectionIndex)
{
var extension = GetExtension(type);
if (type == PathType.EntitiesBinary)
return $"{Application.streamingAssetsPath}/SubScenes/{sceneGUID}.{sectionIndex}.{extension}";
else if (type == PathType.EntitiesHeader)
return $"{Application.streamingAssetsPath}/SubScenes/{sceneGUID}.{extension}";
else if (type == PathType.EntitiesUnityObjectReferences)
return $"{Application.streamingAssetsPath}/SubScenes/{sceneGUID}.{sectionIndex}.bundle";
else
return "";
}
In Unity.Scenes.Hybrid/ResolveSceneReferenceSystem.cs:119-136
var sceneHeaderPath = EntityScenesPaths.GetLoadPath(scene.SceneGUID, EntityScenesPaths.PathType.EntitiesHeader, -1);
#endif
if (!File.Exists(sceneHeaderPath))
{
#if UNITY_EDITOR
Debug.LogError($"Loading Entity Scene failed because the entity header file could not be found: {scene.SceneGUID}\n{sceneHeaderPath}");
#else
Debug.LogError($"Loading Entity Scene failed because the entity header file could not be found: {scene.SceneGUID}\nNOTE: In order to load SubScenes in the player you have to use the new BuildSettings asset based workflow to build & run your player.\n{sceneHeaderPath}");
#endif
return;
}
if (!BlobAssetReference<SceneMetaData>.TryRead(sceneHeaderPath, SceneMetaDataSerializeUtility.CurrentFileFormatVersion, out var sceneMetaDataRef))
{
Debug.LogError("Loading Entity Scene failed because the entity header file was an old version: " + scene.SceneGUID);
return;
}
I apologize for any inaccuracies in Google Translate.
I also noticed that ClassicBuildProfile.GetExecutableExtension () does not contain a handler for BuildTarget.iOS (Unity.Build.Common / Settings / ClassicBuildProfile.cs)