Let's briefly recall the purpose of the ShopPiece script. Each button in the selection grid will be given information from a scriptable object that will customize the button's name, description, value, and image. Because the buttons have changed from being 3D assets to 2D ones, we need to alter and add some more code to make this work.
To modify ShopPiece so that it's compatible with our new 2D button, do the following:
- In the Project window in the Unity Editor, navigate to the Assets/Resources/Script folder.
- Double-click the ShopPiece script to open the file.
The first line of code will allow our new code support to grab references from the Text component on the 00 game object.
- Enter the following piece of code at the top of the ShopPiecescript:
The second modification to make will be...