void ScheduleSceneRead(ReferencedUnityObjects objRefs) { var transaction = _EntityManager.BeginExclusiveEntityTransaction(); SerializeUtilityHybrid.DeserializeObjectReferences(objRefs, out var objectReferences); var loadJob = new AsyncLoadSceneJob { Transaction = transaction, LoadingOperationHandle = GCHandle.Alloc(this), ObjectReferencesHandle = GCHandle.Alloc(objectReferences), FileContent = _FileContent }; _EntityManager.ExclusiveEntityTransactionDependency = loadJob.Schedule(JobHandle.CombineDependencies(_EntityManager.ExclusiveEntityTransactionDependency, _ReadHandle.JobHandle)); }
void ScheduleSceneRead(GameObject sharedComponents) { var transaction = _EntityManager.BeginExclusiveEntityTransaction(); int sharedComponentCount = SerializeUtilityHybrid.DeserializeSharedComponents(_EntityManager, sharedComponents, _ScenePath); if (_ExpectedSharedComponentCount != sharedComponentCount) { _LoadingFailure = $"Expected shared component count ({_ExpectedSharedComponentCount}) didn't match actual shared component count ({sharedComponentCount}) '{_ResourcesPath}'"; _LoadingStatus = LoadingStatus.Completed; return; } var loadJob = new AsyncLoadSceneJob { Transaction = transaction, LoadingOperationHandle = GCHandle.Alloc(this), SharedComponentCount = sharedComponentCount, FileContent = _FileContent }; _EntityManager.ExclusiveEntityTransactionDependency = loadJob.Schedule(JobHandle.CombineDependencies(_EntityManager.ExclusiveEntityTransactionDependency, _ReadHandle.JobHandle)); }
public void Execute() { var loadingOperation = (AsyncLoadSceneOperation)LoadingOperationHandle.Target; LoadingOperationHandle.Free(); try { using (var reader = new MemoryBinaryReader(FileContent)) { k_ProfileDeserializeWorld.Begin(); SerializeUtility.DeserializeWorld(Transaction, reader, SharedComponentCount); k_ProfileDeserializeWorld.End(); k_ProfileReleaseSharedComponents.Begin(); SerializeUtilityHybrid.ReleaseSharedComponents(Transaction, SharedComponentCount); k_ProfileReleaseSharedComponents.End(); } } catch (Exception exc) { loadingOperation._LoadingFailure = exc.Message; } }