UTimelineComponent C++ errors


Author: Matthew Pacheco

This week I had to add feedback to the turrets, vfx and sfx. For the base laser turret, I went with a red laser for visual, click and zap for sounds. The biggest issue I had was with the shooting vfx, specifically, the Turret_Barrel movement with each shot. I decided to use a Timeline to implement the movement of the Turret_Barrels along their X axis when they shoot. Though lasers don't have recoil, it would be a plasma shot at the beginning of the laser that causes it. My issue came with trying to implement code that uses the UTimelineComponent class in C++. 

The UTimelineComponent was an issue since just creating a reference variable of it in the header of my turrets caused 5 unique errors that were displayed 16 times total (Error C2143, Error C4430, Error C2238, Error C2618, Error C2039). These errors only showed up after building, so I didn't initially know that just declaring it was the issue. I implemented code for a Timeline attached to a Float Curve of the -X value, and a Function Delegate for changing the Turret_Barrel's relative position. I took advantage of a Right-Left Bool to figure out which Turret_Barrel to move in the function so there was only one Timeline. Everything looked good until I built it and had a list of errors, all referring to lines that had the Timeline. I spent a long time changing things around before I decided to start stripping it until it built. Once I got back to the .h file, I knew I wasn't going to be able to use it in C++, since no information I found until that point and at the time were close to the issue I had.

My fix for it was to create the Timelines in Blueprint. I was able to expose the variables needed to do the if check, and recreate the function after the timelines were called. I had to also implement a Native_Implementable function that I could call in C++ and would then call the Timeline that only existed in Blueprint. In the end, I decided not to use this as I wanted to maintain the C++ code only.  

Posted on 10/19/2023

Get Cyber Siege

Leave a comment

Log in with itch.io to leave a comment.