Creating Your First Script
You have many options for creating a script. You could click the Add Component button and then select New Script.
But I’d like you to try it this way: select the Scripts folder in the Project Browser, and then click the Createbutton. Select C# Script from the drop-down and name it PlayerController.
You’ll see your new script in the Scripts folder. Drag it from the Scripts folder onto the SpaceMarine GameObject.
You should now see the script listed as one of the components on the Space Marine:
You’ve added your first custom component! Granted, it doesn’t do anything…yet.
You’ll change that in just a moment, but before you do, you need to learn about the Input Manager.
- I am having an issue with a part of the book:
We cannot seem to move the script from the script folder into the SpaceMarine GameObject. Do you have any suggestions.
It says: The associated script cannot be loaded. Please fix any compile errors and assign a valid script.