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

Method Init

Source/Engine/Content/BinaryAsset.cpp:38–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38bool BinaryAsset::Init(const FlaxStorageReference& storage, AssetHeader& header)
39{
40 // We allow to init asset only once like that
41 ASSERT(Storage == nullptr && _header.ID.IsValid() == false);
42
43 // Block initialization with a different storage
44 bool isChanged = _storageRef != storage;
45 if (Storage != nullptr && isChanged)
46 {
47 LOG(Error, "Asset \'{0}\' has been already initialized.", GetPath());
48 return true;
49 }
50
51 // Get data
52 _storageRef = storage;
53 Storage = storage.Get();
54 _header = header;
55
56#if USE_EDITOR
57 // Link for storage reload event
58 if (Storage && isChanged)
59 Storage->OnReloaded.Bind<BinaryAsset, &BinaryAsset::OnStorageReloaded>(this);
60#endif
61
62 return false;
63}
64
65bool BinaryAsset::Init(AssetInitData& initData)
66{

Callers 1

runMethod · 0.45

Calls 7

GetPathFunction · 0.85
GetAssetFunction · 0.85
initFunction · 0.85
IsValidMethod · 0.45
GetMethod · 0.45
CopyMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected