Programming Quick Start - does not work

This is my first time coding in Visual Studio and I have followed the Unreal Programming quick start documentation step by step but I am getting compiler errors. Is their documentation broken or have I done something wrong?

Hey @AdamC_BH ,

I think that this line is wrong in the guide:

if((USceneComponent* ExistingRootComponent = GetRootComponent())

should be

if(USceneComponent* ExistingRootComponent = GetRootComponent())

BUT
If you scroll down you have the finished example without an IF statement.

4 Likes

Hi Adam, welcome to the community. The tutorial you mention says add the following code inside of AFloatingActor::AFloatingActor(), just before the closing bracket, which is the constructor.
You did add this one to the BeginPlay() - so I suggest to first move that to the Constructor, which is the function just above the BeginPlay() and see, if this helps.
And, there seems to be one parenthese , that causes the problem. remove one of these after the if statement, as L1z4rD89 mentioned.

3 Likes

@L1z4rD89 @herb64 Thank you for your help guys it’s working now, I’d put the code in the wrong place but it was the extra parenthesis before USceneComponent causing the errors.

Hopefully this helps any other beginners as it was copied directly from the Epic documentation

2 Likes