Time for action – turning input into movement
We'll now use the input library you imported to capture data from the controller and translate it into movement that will be applied to our marble by performing the following steps:
Create a
Scripts
folder in yourAssets
directory to store all of your script files, if you haven't already done so, then right-click on it and create a new C# script.Name the file
MarbleInputManager
and open it in your preferred code editor.Recall the
Start
andUpdate
functions from Chapter 3, Diving into Development, which will already be present in the code file; we'll be usingUpdate
for most of this chapter.To link the code file with your marble, left-click and drag it onto the prefab you created or add it as a new script component using the Add Component button in the Inspector menu.
You can also drag it onto the actual marble on the screen, but this will only apply the script to that instance of the prefab; adding the script to the prefab itself will cause all...