Lauren and return to continue their 2D Tanks vs. Zombies game with C++. In this stream, they’ll do a quick level tile map, and then add movement functions to their tank. With WASD to move and a click-to-aim turret, let’s get these tanks moving!
From the first lesson, I still have the problem that whenever I move the childTurret in the TankBP viewport and recompile, the engine creates a new child which is visible in both the editor viewport and the BP viewport itself as described in the old anouncement thread by another user.
I checked my code and compared it with yours and it is literally the same but maybe I missed something. It would be nice if you could make a statement either at the beginning of the second video or in the thread about whether the UCHildActorComponent stuff is buggy in 4.11 or well, I don’t know to be honest I started the project in 4.11 preview 4 or whenever your first lesson aired, just for your information.
To be honest with you guys, I really appreciate what you are doing for the community and I know this must be a lot! of work, but for the future I think it would be nice if you could have an eye on the accompanying thread for further help as the other thread didn’t get a lot of attention by both of you. (Of course there was GDC etc. so nothing personal and I hope you take my opinion in a neutral way)
Lauren and I just checked this, and it happens here, too. That looks like a bug! I’ll report it to QA in a few minutes.
Well, it can be an issue if you use a different version of the engine from what we have. We used 4.10.4 on the stream, not 4.11 Preview 4, so that could cause errors. However, in this case, it’s a legitimate engine bug. It is worth noting that since the game re-instantiates all objects on startup, your tank in-game (including PIE) should be fine, and should have only one child turret, even though it will have more than one in the editor.
We do attempt to stay on top of threads, but some posts may fall through the cracks, or may be addressed by other people like community members or other Epic staff. We’ll see if we can improve that. Thanks for your feedback!
it would be nice if you show how each part of code affects the tank(or game) instead of just typing the code and with a little explain on what it does , and after everything is done then showing the game.
its a little unclear for people like me who not familiar with C++ coding in UE . for me this part 2 was more like reading a documentation instead of watching a video tutorial.
I’ve had a ton of issues with this, but I eventually found out that my blueprints weren’t updating after changing the C++ files they derived from, which led to empty details panels on some components and various Static/Movable mismatch errors.
The only way I’ve found to update them is to change the parent to something basic like Actor, then back to Tank/Turret, which resets it as if I just created a brand new Blueprint. so have to re-set the sprites/rotations etc.
Also, not sure if it was really needed, but I also followed a workaround posted in an Answerhub post for the ChildActor parenting issue which suggested to set the Child Actor in Construction Script instead of the Component details panel.
I’m trying to follow along with the tutorial but I’m stuck at the USTRUCT part. I’m using Engine 4.17 while this was designed to work with 4.10 so I know there will be changes.
I keep getting the below errors:
CompilerResultsLog: Error: D:/UE4/Projects/Tanks/Source/Tanks/Tank.h(19) : LogCompile: Error: Cannot expose property to blueprints in a struct that is not a BlueprintType. TankInput.MovementInput
CompilerResultsLog: Error: D:/UE4/Projects/Tanks/Source/Tanks/Tank.h(75) : LogCompile: Error: Type ‘FTankInput’ is not supported by blueprint. Tank.TankInput
CompilerResultsLog: Error: UnrealHeaderTool failed for target ‘TanksEditor’ (platform: Win64, module info: D:\UE4\Projects\Tanks\Intermediate\Build\Win64\TanksEditor\Development\TanksEditor.uhtmanifest, exit code: OtherCompilationError (5)).
And the Code I have for the struct is:
// Sanitized movement input, usable for game logic.
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Tank Input")
void MoveX(float AxisValue);
void MoveY(float AxisValue);
// Private because it's internal, raw data. Game code should never see this.
I’ve tried to go ahead to see if something changed later on in the tutorials but I am unable to find this issue. Everything I’ve searched for just returns that the UPROPERTY needs to be editable in the Blueprint, so I’ve tried to change “BlueprintReadOnly” to “BlueprintReadWrite”.
Hey, ChappyOak! You’re right some changes have taken place that affect this code. USTRUCTS that you wish to use as UPROPERTIES must now be BlueprintTypes. So you just need to change this part of your code:
That change came about in 4.17, I think, or maybe 4.16, which is why this was fine in 4.10. That should get it working for you. I’ll update the source file when I get a . Thanks for watching and posting!
EDIT: On attempting this myself, there’s one other change that must be made before this will compile. The UArrowComponent’s header file, Runtime/Engine/Classes/Components/ArrowComponent.h, should be included in Tank.h. This will be in the source code update that I post in the next few minutes.
, I made those changes and the errors I have listed were solved but now I have some other errors. I’ve tried to recreate the project with your source code to remove them, but they still remain. CompilerResultsLog: Error: D:\UE4\Projects\Tanks\Source\Tanks\TanksGameMode.cpp(1) : error: Expected TanksGameMode.h to be first header included. CompilerResultsLog: Error: D:\UE4\Projects\Tanks\Source\Tanks\TankStatics.cpp(1) : error: Expected TankStatics.h to be first header included. CompilerResultsLog: Error: D:\UE4\Projects\Tanks\Source\Tanks\Turret.cpp(1) : error: Expected Turret.h to be first header included. So I changed these lines to reflect the order required. I’m currently investigating the errors that followed, as they may be a result from some setting or lack of.
This is a great tutorial, but I’m having a little trouble with the third stream. I’m my Turret.h I have forward declared ATanksVsZombies but it is giving me this error: 2>D:/UnrealEngine/Projects/TanksVsZombies/Source/TanksVsZombies/Turret.h(31): error : Unrecognized type ‘ATanksVsZombies’ - type must be a UCLASS, USTRUCT or UENUM
Any help would be great! Thank you!
**Solution **- I had to remake this using blueprints and found that you need to use this line: [FONT=courier new]CameraComponent->SetWorldRotation(FRotator(0.0f, 0.0f, 0.0f));
That is there should be no -90 rotation on the Camera?
**Problems with [FONT=courier new]FVector2D MovementInput;? **
You are getting these errors: [FONT=courier new]…/Tank.h(19) : LogCompile: Error: Cannot expose property to blueprints in a struct that is not a BlueprintType. TankInput.MovementInput
…/Tank.h(80) : LogCompile: Error: Type ‘FTankInput’ is not supported by blueprint. Tank.TankInput