UPROPERTY(EditAnywhere) causes actor Transform to disappear

Hi All,

I am finding that when I add UPROPERTY above a variable, it causes the Actor Transform to disappear. I am just getting started with Unreal, downloaded and installed, and started working through the Getting Started docs. The first C++ example works fine, the one with the cone floating up and down above the table. From these docs here:
Getting Started

Then I move on the very next doc, Introduction to C++ Programming in UE4, and as soon as I add the lines below and compile, the Transform section disappears from the Actor details in the editor, and the cone no longer moves. The handle to the cone actor appears at the origin in the editor, and when I move and release it, it snaps back to zero.

    UPROPERTY(EditAnywhere)
    int32 TotalDamage;

If someone could try to reproduce this with a new C++ Blank project in 4.7.2, I would greatly appreciate it. It should only take a few minutes. I can proceed to poke around the tutorials, but it seems like the concept of exposing variables through the editor is a key concept in Unreal. I’m kinda stuck just getting out of the starting gate here.

Hey ripridehi-

Select the actor in your scene and make sure you give it a component. With the actor selected click Add Component and select one of the Basic Shapes. This should cause the Transform category to show up as well as allow the actor to be movable around the level.

Cheers

Thanks for the reply . I have already added a component. That is step 4 of the C++ Programming Quick Start Guide here: 4. Test Your Code. Following the steps 1 through 4 verbatim, I successfully have a cone floating up and down as expected. The problem is introduced in the next document Introduction to C++ Programming in UE4. Adding a UPROPERTY macro to the previously working actor header file, and the Transform disappears from the actor details.
I have repeated the steps in the doc several times, so either the docs are out of date, or there is a bug.

I am now in the process of debugging the code, and have found that after initially adding the component, and drilling down into:

bool AActor::SetActorLocation(const FVector& NewLocation, bool bSweep, FHitResult* OutSweepHitResult)
{
	if (RootComponent)
	{

RootComponent is true, or non-NULL. After I add the UPROPERTY line and the Transform disappears, RootComponent becomes NULL.

I just tried to delete the cone component from the editor, with the intent of adding it back in to see if that refreshed things, but the editor crashed. I have the crash dump if someone wants it.

I’m convinced there is a bug somewhere related to adding UPROPERTY. So, I’m learning stuff, poking around, figuring out how to debug, etc, but surely this is not the intended “Getting Started” flow.

Hey ripridehi-

Prior to adding the UPROPERTY() macro when you have MyActor1 selected in the World Outliner you should see MyActor1 (Instance) and Cone in the Details window under Add Components. MyActor1 (Instance) is essentially a copy of the code class that was created and does not have any visual representation in the world. Selecting the cone will show the transform category for the cone itself which can be moved around. Reselecting the instance of MyActor1 will show that it is still at the origin and unmovable. When you add the UPROPERTY() macro and compile the code again the editor is changing the selection from the cone mesh to the actor instance which is why the transform is disappearing. Reselecting the cone in the components list should bring the transform back and allow you to move it around. This can be confusing for workflow which I have created a bug report for (UE-11584).

Cheers

Thanks again . I still think there is a problem though, either with the steps in the documentation, or there is a bug. When you add an instance of an actor and add a component to it, the Transform is visible when either the MyActor1 or the cone component is selected. The code added in step 4 linked above works fine. After you add the UPROPERTY line, the code no longer works - the cone component no longer floats up and down. As I said earlier, the RootComponent is NULL.

To summarize, follow steps 1 through 4 of getting started, you have a working example. Then add these lines to the header file, add nothing else, the example no longer works:

    UPROPERTY(EditAnywhere)
    int32 TotalDamage;    

Also note that item 4 of Step 4 specifilcally states to set the transform of the MyActor1, not the transform of the component:

use the Details Panel to select “MyActor1 (Instance)”. We can now edit the Location field of MyActor1’s Transform directly.

Thanks for the help. If you could try to repro it yourself, that would be great. It literally only takes about 3 or 4 minutes.

It appears that any actor already in the scene that is affected by the class changes will experience this bug after the hot reload. However creating a new instance by selecting the class in the Content Browser and dragging it into the scene can have the static mesh added to it and will show the updated UPROPERTY().

Ok, thanks for the help.