UE 4 Endless Runner Problem with spawning Tiles

Hi there! I decided to make Endless Runner following tutorial on YouTube by official Unreal Engine… Right now I’m on Part 2 and I got huge problem… Well, better said 2 problems… So, first - I did everything like “tut man” did, and ther’s happening this (Picture 2). It has to spawn in a row, not above it. Second, there’s compile problem with casting - if i delete CastTo BP_FloorTile it compile, but if not, it wont. Here’s the link : Endless Runner: Spawning the Course | 02 | v4.7 Tutorial Series | Unreal Engine - YouTube it’s about 6:43 i think alt text

Hi ,

What error are you given when you try to compile the blueprint with Cast To BP_FloorTile present? Also, when it comes to your tiles being higher than the previous ones, are you sure that your ‘Attach Point’ is in the correct spot? You can see this @2:30 in the video that you linked.

1 Like

You can remove the cast, it should not be needed. Casting is only needed to specify the exact object type, but the spawn actor node is already doing that for your.
In your instance your specific instance I believe it is an issue of having a different UE4 build than the one used in the tutorial. Not having to cast is better since you are spawning a specific type, UE4 should be smart enough to not need to verified. My guess would be the tutorial was compensating for a flaw (or lack of feature) that would present the “spawnactor” node from being able to properly define its object reference.

Here is a rundown of what casting is normally used for.
Example: Say I have an object of type “Vehicle” which has several child classes such as “Truck”, “Sedan”, “18Wheeler” and so on. I can take any instances of these object and reference them as “Vehicle” since it’s their parent class, however I wont be able to access any of their child specific nodes (functions).

If I did want to access a specific function of a child object I would need to the reference to that object type.

Alternatively you can be lazy and use it as a sorting system. Example: say I have a button that will have a different output depending on who (which class type) activates it. I can have a function that tries to cast as one class. If it succeeds I know I hit the correct class, and if it fails I can have it then try to cast to another class which also checks to see if it fails and goes to another class, so on and so on.

Either 2 things are happening here,

  1. Your arrow (attachtransform) is in the wrong position
  2. Your arrow (attach transform) is in the correct position, but the mesh (walls, floors) are in the wrong position.

Click on your “floor” mesh of your object in the viewport and make sure the location (top right side of the program) matches whats in the video (looks like its x=500,y=0,z=0) Endless Runner: Spawning the Course | 02 | v4.7 Tutorial Series | Unreal Engine - YouTube

If that looks good click on the attachtransform and make sure its at x=1000,y=0,z=0 like this frame of the video:

most likely one (or both) of these have Z values that are not 0.

Error message is or says : ‘Return Value’ is already a ‘BP_Floor Tile’, you don’t need Cast To BP_Floor Tile
and arrow is heade right way… dunno why

Okay, now it’s almost working, thanks for help! But there’s something another. Instead of spawnig above, first tile has problem. Take a look at image. I changed Arrow Position so I’m not sure if I have to do it again.

EDIT : New problem. At the 3rd video (Endless Runner: Creating Obstacles | 03 | v4.7 Tutorial Series | Unreal Engine - YouTube) at the time 2:22 is giving Get Relative Transform. He can attach Relative Transform to Set Spawn Points but I can’t (see pic). I hope it’s because of different engine version…

Hi ,

As for your misplaced tile, this is due to the position of your arrow component. If you refer to the video, he has the arrow component on the same side as the tile that is to be spawned, pointing away from the current tile. You currently have it on the opposite side pointing inward.

Edit: At least that is the way it seems. I cannot tell where your individual components are placed from the screenshot you provided.

For your second issue, this is explained by an annotation at 3:00. If you connect things as shown in the video, but connect the execution pin straight from Set Spawn Points to the node where you’re actually setting the spawn points, it’ll still work the same way. Here is an example:

Okay, thank you a lot for helping me ! :slight_smile: Gonna try to do fix it as you said