public static unsafe Hash128 CreateBuildConfigurationSceneFile(Hash128 sceneGUID, Hash128 buildConfigurationGUID) { var guid = ComputeBuildConfigurationGUID(sceneGUID, buildConfigurationGUID); var guids = new SceneWithBuildConfigurationGUIDs { SceneGUID = sceneGUID, BuildConfiguration = buildConfigurationGUID }; var dir = "Assets/SceneDependencyCache"; var fileName = $"{dir}/{guid}.sceneWithBuildConfiguration"; if (!File.Exists(fileName)) { if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } using (var writer = new Entities.Serialization.StreamBinaryWriter(fileName)) { writer.WriteBytes(&guids, sizeof(SceneWithBuildConfigurationGUIDs)); } File.WriteAllText(fileName + ".meta", $"fileFormatVersion: 2\nguid: {guid}\nDefaultImporter:\n externalObjects: {{}}\n userData:\n assetBundleName:\n assetBundleVariant:\n"); // Refresh is necessary because it appears the asset pipeline // can't depend on an asset on disk that has not yet been refreshed. AssetDatabase.Refresh(); } return(guid); }
public static unsafe Hash128 CreateBuildSettingSceneFile(Hash128 sceneGUID, Hash128 buildSettingGUID) { var guids = new SceneWithBuildSettingsGUIDs { SceneGUID = sceneGUID, BuildSettings = buildSettingGUID }; Hash128 guid; guid.Value.x = math.hash(&guids, sizeof(SceneWithBuildSettingsGUIDs)); guid.Value.y = math.hash(&guids, sizeof(SceneWithBuildSettingsGUIDs), 0x96a755e2); guid.Value.z = math.hash(&guids, sizeof(SceneWithBuildSettingsGUIDs), 0x4e936206); guid.Value.w = math.hash(&guids, sizeof(SceneWithBuildSettingsGUIDs), 0xac602639); string dir = "Assets/SceneDependencyCache"; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } string fileName = $"{dir}/{guid}.sceneWithBuildSettings"; if (!File.Exists(fileName)) { using (var writer = new Entities.Serialization.StreamBinaryWriter(fileName)) { writer.WriteBytes(&guids, sizeof(SceneWithBuildSettingsGUIDs)); } File.WriteAllText(fileName + ".meta", $"fileFormatVersion: 2\nguid: {guid}\nDefaultImporter:\n externalObjects: {{}}\n userData:\n assetBundleName:\n assetBundleVariant:\n"); // Refresh is necessary because it appears the asset pipeline // can't depend on an asset on disk that has not yet been refreshed. AssetDatabase.Refresh(); } return(guid); }