Selecting game objects with raycasts
In this section, we are going to create the final shop script, PlayerShipBuild
. This script holds properties such as selecting any button from the selection grid, running adverts, communicating with our existing game framework scripts, launching our game to play, and a few other things that we will cover.
One of the subjects you will likely come across in your Unity programmer exam and when developing games/applications in Unity is shooting invisible lasers, which are used for things such as shooting a gun, making a selection in three-dimensional space, and more. In this section, we are going to make a button on the selection grid light up blue when the player presses on it to let them know that it has been selected. We already have each of our buttons set up with blue rectangles that are permanently on. So, all that we need to do now is turn them all off when the scene becomes active and make any of the buttons turn on when a ray (invisible...