fr.jeanf.scenemanagement 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,8 +88,7 @@ namespace jeanf.SceneManagement
88
88
  playerTransforms.Dispose();
89
89
  }
90
90
 
91
- bool playerMoved = !_hasLastPosition ||
92
- (hasPlayer && math.lengthsq(playerPosition - _lastPlayerPosition) > MOVEMENT_THRESHOLD_SQ);
91
+ bool playerMoved = !_hasLastPosition || (hasPlayer && math.lengthsq(playerPosition - _lastPlayerPosition) > MOVEMENT_THRESHOLD_SQ);
93
92
 
94
93
  int sectionCount = _sectionQuery.CalculateEntityCount();
95
94
  bool hasNewSections = sectionCount != _interceptedSections.Count;
@@ -122,6 +121,7 @@ namespace jeanf.SceneManagement
122
121
  _sectionsToLoad.Clear();
123
122
 
124
123
  var ecb = new EntityCommandBuffer(Allocator.Temp);
124
+ bool interceptedNewSections = false;
125
125
 
126
126
  for (int i = 0; i < sectionEntities.Length; i++)
127
127
  {
@@ -155,6 +155,8 @@ namespace jeanf.SceneManagement
155
155
  if (isNewSection)
156
156
  {
157
157
  s_InterceptMarker.Begin();
158
+ interceptedNewSections = true;
159
+
158
160
  if (!shouldBeLoaded)
159
161
  {
160
162
  if (hasRequestSceneLoaded)
@@ -168,6 +170,13 @@ namespace jeanf.SceneManagement
168
170
  SceneSystem.UnloadScene(state.WorldUnmanaged, sectionEntity, SceneSystem.UnloadParameters.Default);
169
171
  }
170
172
  }
173
+ else
174
+ {
175
+ if (!hasRequestSceneLoaded)
176
+ {
177
+ ecb.AddComponent<RequestSceneLoaded>(sectionEntity);
178
+ }
179
+ }
171
180
 
172
181
  _interceptedSections.Add(sectionEntity);
173
182
  s_InterceptMarker.End();
@@ -184,17 +193,14 @@ namespace jeanf.SceneManagement
184
193
  }
185
194
  else
186
195
  {
187
- if (_sectionsToLoad.Count > 0)
196
+ if (hasRequestSceneLoaded)
188
197
  {
189
- if (hasRequestSceneLoaded)
190
- {
191
- ecb.RemoveComponent<RequestSceneLoaded>(sectionEntity);
192
- }
193
-
194
- if (sectionState == SceneSystem.SectionStreamingState.Loaded)
195
- {
196
- SceneSystem.UnloadScene(state.WorldUnmanaged, sectionEntity, SceneSystem.UnloadParameters.Default);
197
- }
198
+ ecb.RemoveComponent<RequestSceneLoaded>(sectionEntity);
199
+ }
200
+
201
+ if (sectionState == SceneSystem.SectionStreamingState.Loaded)
202
+ {
203
+ SceneSystem.UnloadScene(state.WorldUnmanaged, sectionEntity, SceneSystem.UnloadParameters.Default);
198
204
  }
199
205
  }
200
206
  s_LoadUnloadMarker.End();
@@ -4836,7 +4836,8 @@ MonoBehaviour:
4836
4836
  sectionDistances:
4837
4837
  - 25
4838
4838
  - 100
4839
- sectionIndices: 0100000002000000
4839
+ - 200
4840
+ sectionIndices: 010000000200000003000000
4840
4841
  --- !u!4 &1757271947
4841
4842
  Transform:
4842
4843
  m_ObjectHideFlags: 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fr.jeanf.scenemanagement",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "displayName": "Scene Management",
5
5
  "description": "This package contains two scene loading system, one is additive, the other is to load subscenes. \nBoth system are living side-by-side.\nThe dynamic systems handles the loading of all static content (environment) using subscenes.\nThe additive system loads scene additively depending on zone & region and upon scenario load/unload requests. Each region or scenario can have dependency that will remain loaded until either a region or a scenario became irrelevant.",
6
6
  "unity": "2021.3",