If you press Play, the game will spawn a tunnel above and away from the player. This will add an instance of it to the level.
Left-click and drag BP_TunnelSpawner into the Viewport. Afterwards, press the Delete key to remove it from the level. Do this by left-clicking on BP_Tunnel in the World Outliner. Click Compile and then go back to the main editor.įirst, delete BP_Tunnel from the level. Now, when the game starts, it will spawn a tunnel up and away from the player. On the SpawnTunnel node, set Spawn Location to (2000, 0, 500). Add a SpawnTunnel node and connect it to the Event BeginPlay node. Switch to the Event Graph and locate the Event BeginPlay node. Let’s test it out! Testing the Tunnel Spawner Now, whenever you call the SpawnTunnel function, it will spawn an instance of BP_Tunnel at the provided location. Afterwards, link the Spawn Actor From Class node to the Entry node like so: To set the spawn location, right-click the Spawn Transform pin and select Split Struct Pin. Click the drop-down located to the right of the Class pin and select BP_Tunnel. To spawn a tunnel, add a Spawn Actor From Class node. Rename the input parameter to SpawnLocation and change its type to Vector. Click the + sign next to the Inputs section. Select the Entry node and then go to the Details panel. Make sure you are in the graph for the SpawnTunnel function. Let’s go ahead and create an input parameter. They will also appear as output pins on the Entry node of the function. These will appear as input pins when you call the function. To pass a location to the function, the function needs an input parameter. The purpose of this function will be to spawn a tunnel at a provided location. Go to the My Blueprint panel and create a new function named SpawnTunnel. Since the game will be spawning tunnels constantly, it’s a good idea to create a spawning function. Name it BP_TunnelSpawner and then open it. Create a new Blueprint Class with Actor as the parent class.
Go to the Content Browser and make sure you are in the Blueprints folder. Instead of placing tunnels manually, you can create a Blueprint that spawns tunnels automatically. If you press Play, you will move through the tunnel.
Using a familiar "Roll a Ball" style game as the template for the course you'll get the opportunity to learn a huge amount about the Unreal Engine and understand how to transfer that knowledge into your projects. Learn to not only use UE4 but gain transferable skills that will assist you in any game development endeavour.īuild a complete game from an empty project up to packaging and sharing your work while getting an understanding of: Unreal Engine 4 is one of the most powerful and accessible game engines currently available and with the release of Unreal Engine 5 just around the corner, there's no better time to start your Epic journey.