MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / load

Method load

Source/Engine/Engine/GameplayGlobals.cpp:161–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161Asset::LoadResult GameplayGlobals::load()
162{
163 // Get data
164 const auto chunk = GetChunk(0);
165 if (!chunk || !chunk->IsLoaded())
166 return LoadResult::MissingDataChunk;
167 MemoryReadStream stream(chunk->Get(), chunk->Size());
168
169 // Load all variables
170 int32 count;
171 stream.Read(count);
172 Variables.EnsureCapacity(count);
173 String name;
174 for (int32 i = 0; i < count; i++)
175 {
176 stream.Read(name, 71);
177 auto& e = Variables[name];
178 stream.Read(e.DefaultValue);
179 e.Value = e.DefaultValue;
180 }
181 if (stream.HasError())
182 {
183 // Failed to load data
184 Variables.Clear();
185 return LoadResult::InvalidData;
186 }
187
188 return LoadResult::Ok;
189}
190
191void GameplayGlobals::unload(bool isReloading)
192{

Callers

nothing calls this directly

Calls 7

GetChunkFunction · 0.85
IsLoadedMethod · 0.45
GetMethod · 0.45
SizeMethod · 0.45
ReadMethod · 0.45
EnsureCapacityMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected