#pragma once #include #include #include #include #include #include #include #include #include namespace PalUIExtension::Reflection { using namespace RC; using namespace RC::Unreal; class UnrealObjectRef { public: explicit UnrealObjectRef(const TCHAR* Path, const TCHAR* DebugTag) : m_path(Path), m_debug_tag(DebugTag) { Static::ClassCache::RegisterSlot(&m_cached); } auto Get() -> UObject* { if (m_cached) return m_cached; m_cached = UObjectGlobals::StaticFindObject(nullptr, nullptr, m_path, false); if (!m_cached) { Output::send(STR("[{}] could not resolve '{}'\n"), m_debug_tag, m_path); } return m_cached; } private: const TCHAR* m_path; const TCHAR* m_debug_tag; UObject* m_cached{}; }; }