Moving cubes using events

Al Heck
Dec 3, 2021

Let’s move the cube to a different position using events. We will use a space bar to move our position to 5, 2, 0. First, we need to properly declare the event.

Then we need to create our space bar functionality. In it, we will pass in our position and then apply that position to our onTeleport event. Keep in mind, ever object that is listening to this event will always move to the same place.

Finally, we will create a function on our cube called Spawn and it will pass in the values from our onTeleport event.

--

--

Al Heck

Unity Developer and Software Engineer who loves making games with GameDevHQ