I got error while compile C++ actor and drag it into scene

Hi, All,

[Quesion#1]
I just following the process of link:
Unreal Engine CPP Quick Start | Unreal Engine 5.3 Documentation
I added two variables in my .h file as follow:

But after saving code. VS will show following logs.
Running UnrealHeaderTool for “G:\UNREALPROJECTS\CPPLEARNING\TEST53\SOURCE\TEST53\MYACTOR.CPP”
Cannot find a valid build command in the project’s active configuration. Stopping.
Running UnrealHeaderTool for “G:\UNREALPROJECTS\CPPLEARNING\TEST53\SOURCE\TEST53\MYACTOR.H”
Cannot find a valid build command in the project’s active configuration. Stopping.

I installed UnrealVS extension in VS:


And also installed and enabled Visual Studio Integration tools in UE editor.
image
I don’t know what the problem is.

[Question#2]
I tried to use Live Coding in UE editor to build my code.
If I only have one int variable it seems no error. And I can drag my new actor into scene.
image


But after saving and reopen UE. The added actor disappear. And the C++ class folder in Content Browser also disappear.
image
The folder only appear after I execute the Live Coding building again , but the added actor still no in the scene.
image

Anyone know why the added actor canned be saved?

[Question#3]
I added back my VisualMesh in .h file.
UPROPERTY(VisibleAnyWhere)
UStaticMeshComponent* VisualMesh;

And then add following code in the constructor function in .cpp
After Live Coding executed, I can see the blue-print changes(but sometimes it doesn’t change)


After I drag it into scene.
image
I got following log:
LogEditor: Attempting to add actor of class ‘MyActor’ to level at 450.00,450.00,0.00
LogActor: Warning: MyActor /Temp/Untitled_1.Untitled_1:PersistentLevel.MyActor_1 has natively added scene component(s), but none of them were set as the actor’s RootComponent - picking one arbitrarily
LogEditor: Attempting to add actor of class ‘MyActor’ to level at 120.00,200.00,0.00
LogActor: Warning: MyActor /Temp/Untitled_1.Untitled_1:PersistentLevel.MyActor_UAID_D85ED3A8028CA9AA01_1640418425 has natively added scene component(s), but none of them were set as the actor’s RootComponent - picking one arbitrarily
LogWorldSubsystemInput: UEnhancedInputDeveloperSettings::bEnableWorldSubsystem is false, the world subsystem will not be created!

And again, this actor also will disappear after saving level and reopen UE.

1 Like

I have the same issue. Were you ever able to resolve this?

right click on you project in solution explorer and choose “Set as startup project”. Then compile your project. Not sure if it is what actually causing the problem but worth trying.

P.S: New classes/structs do not work with live coding. You need to do a full compile after creating a new one.

2 Likes

Setting my project as the Startup Project worked for me.