“Problems with Blueprints”
by William Terlop
I began creating lose conditions for my player recently and one of those is instant death when touching molten metal. This means if a player falls into the vat of metal they will die instantly. This sounded like something easy to achieve so I began prototyping. The issue I ran into was when using blueprints the player would die when touching the metal and the level would restart.. However, the real issue was that any object or mesh associated with the player would also trigger the level restart. This included things like projectiles. When the player shot into the level it would trigger as a death. Sometimes a collision would not trigger the reset at all.. this took some time to figure out.
I began troubleshooting this issue by playing debug print statements on interactions within the blueprints. There were two components at play. The collision of the objects and the lava, and the actual restarting of the level itself. The level reset took place in the level blueprint. The collision was attached to the player and the lava collider box. Placing print statements allowed me to see what was being triggered where.. I was able to use this to tweak the blueprints to find the player based on the tag rather than any skeletal mesh on the character.
The other issue was having was passing the variable from one blueprint to another. I kept seeing the variable change on one blueprint, but it was not registering in the other. This was preventing the level from restarting. I again had to use debug statements to see when each blueprint was reading the value. It turned out that the level itself was not getting an updated message when the variable changed. It took some research online to learn about tick events and how they are used to read from variables constantly.
This was a great learning experience and now I feel more confident in passing variables from one aspect of the game to the other!