Add more contextual log printing on missing object/asset reference
#2414
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "Loading/ContentLoadingManager.h"
|
||||
#include "Loading/Tasks/LoadAssetTask.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/LogContext.h"
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Threading/Threading.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
@@ -587,9 +588,10 @@ bool Asset::IsInternalType() const
|
||||
|
||||
bool Asset::onLoad(LoadAssetTask* task)
|
||||
{
|
||||
if (task->Asset.Get() != this || Platform::AtomicRead(&_loadingTask) == 0)
|
||||
// It may fail when task is cancelled and new one was created later (don't crash but just end with an error)
|
||||
if (task->Asset.Get() != this || Platform::AtomicRead(&_loadingTask) == 0)
|
||||
return true;
|
||||
LogContextScope logContext(GetID());
|
||||
|
||||
Locker.Lock();
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "Storage/JsonStorageProxy.h"
|
||||
#include "Factories/IAssetFactory.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/LogContext.h"
|
||||
#include "Engine/Core/Types/String.h"
|
||||
#include "Engine/Core/ObjectsRemovalService.h"
|
||||
#include "Engine/Engine/EngineService.h"
|
||||
@@ -970,6 +971,7 @@ Asset* Content::LoadAsync(const Guid& id, const ScriptingTypeHandle& type)
|
||||
if (IsAssetTypeIdInvalid(type, result->GetTypeHandle()) && !result->Is(type))
|
||||
{
|
||||
LOG(Warning, "Different loaded asset type! Asset: \'{0}\'. Expected type: {1}", result->ToString(), type.ToString());
|
||||
LogContext::Print(LogType::Warning);
|
||||
return nullptr;
|
||||
}
|
||||
return result;
|
||||
@@ -1004,6 +1006,7 @@ Asset* Content::LoadAsync(const Guid& id, const ScriptingTypeHandle& type)
|
||||
if (!GetAssetInfo(id, assetInfo))
|
||||
{
|
||||
LOG(Warning, "Invalid or missing asset ({0}, {1}).", id, type.ToString());
|
||||
LogContext::Print(LogType::Warning);
|
||||
LOAD_FAILED();
|
||||
}
|
||||
#if ASSETS_LOADING_EXTRA_VERIFICATION
|
||||
|
||||
Reference in New Issue
Block a user