Skip to content

Compatible with Unreal Engine 5.7#32

Open
gapspt wants to merge 1 commit into
prajwalshettydev:mainfrom
gapspt:main
Open

Compatible with Unreal Engine 5.7#32
gapspt wants to merge 1 commit into
prajwalshettydev:mainfrom
gapspt:main

Conversation

@gapspt

@gapspt gapspt commented Feb 6, 2026

Copy link
Copy Markdown

Adds compatibility with Unreal Engine 5.7

  • ANY_PACKAGE usages removed (FindObject replaced with FindFirstObjectSafe)
  • Add missing include for FStringOutputDevice (Misc/StringOutputDevice.h)

Copilot AI review requested due to automatic review settings February 6, 2026 22:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the editor support utilities to be compatible with Unreal Engine 5.7 by replacing deprecated global object/class lookup patterns and adding required includes.

Changes:

  • Replaced FindObject<UClass>(ANY_PACKAGE, ...) usages with FindFirstObjectSafe<UClass>(...) across MCP utility code.
  • Added missing include for FStringOutputDevice usage in widget utilities.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
Source/GenerativeAISupportEditor/Private/MCP/GenWidgetUtils.cpp Adds StringOutputDevice include and updates widget class lookup to FindFirstObjectSafe.
Source/GenerativeAISupportEditor/Private/MCP/GenBlueprintUtils.cpp Updates class/component lookup to FindFirstObjectSafe (note: one prefixed lookup likely regresses behavior).
Source/GenerativeAISupportEditor/Private/MCP/GenBlueprintNodeCreator.cpp Updates node/library class lookups to FindFirstObjectSafe (note: node class name prefixing looks incorrect).
Source/GenerativeAISupportEditor/Private/MCP/GenActorUtils.cpp Updates actor/game mode class lookup to FindFirstObjectSafe (note: unused FullClassName and missing fallback).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{
FString PrefixedClassName = TEXT("/Script/Engine.") + ClassName;
Class = FindObject<UClass>(ANY_PACKAGE, *PrefixedClassName);
Class = FindFirstObjectSafe<UClass>(*PrefixedClassName);

Copilot AI Feb 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FindFirstObjectSafe is being called with a "/Script/Engine.<Class>"-style string. FindFirstObjectSafe searches by object name and may not resolve object paths, so this prefixed lookup can become a no-op and regress class resolution. Consider using LoadClass/StaticLoadClass for "/Script/..." paths (or FindObject with a nullptr outer + full path) and keep FindFirstObjectSafe for unqualified names only.

Suggested change
Class = FindFirstObjectSafe<UClass>(*PrefixedClassName);
Class = StaticLoadClass(UObject::StaticClass(), nullptr, *PrefixedClassName);

Copilot uses AI. Check for mistakes.
Comment on lines 138 to 142
// Try to find class by name
FString FullClassName = FString::Printf(TEXT("/Script/Engine.%s"), *ActorClassName);
ActorClass = FindObject<UClass>(ANY_PACKAGE, *ActorClassName);
ActorClass = FindFirstObjectSafe<UClass>(*ActorClassName);

if (!ActorClass)

Copilot AI Feb 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FullClassName is constructed but never used, and the class lookup only tries the unqualified ActorClassName. Either remove FullClassName or use it as a fallback (e.g., attempt to load/find "/Script/Engine.<ActorClassName>") so engine classes resolve consistently.

Copilot uses AI. Check for mistakes.
}

UClass* NodeClass = FindObject<UClass>(ANY_PACKAGE, *(TEXT("UK2Node_") + ActualNodeType));
UClass* NodeClass = FindFirstObjectSafe<UClass>(*(TEXT("UK2Node_") + ActualNodeType));

Copilot AI Feb 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lookup uses "UK2Node_" + ActualNodeType, but UObject names for these classes typically drop the U prefix (e.g., UK2Node_IfThenElse has the object name K2Node_IfThenElse). This means the first lookup will never match and wastes work; it can also prevent finding nodes when only the class name suffix is provided. Consider using "K2Node_" + ActualNodeType (and/or avoid double-prefixing when ActualNodeType already starts with K2Node_).

Suggested change
UClass* NodeClass = FindFirstObjectSafe<UClass>(*(TEXT("UK2Node_") + ActualNodeType));
FString LookupName = ActualNodeType;
if (!ActualNodeType.StartsWith(TEXT("K2Node_")))
{
LookupName = TEXT("K2Node_") + ActualNodeType;
}
UClass* NodeClass = FindFirstObjectSafe<UClass>(*LookupName);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants