Posted January 24, 2024 by GoldMoonStudio
Author: Aaronn Solomon
1/24/2024
The Problem
I decided to add pictures of each weapon to the loadout menu. Unfortunately, I had no idea how to use sprites properly, and the pictures were always just reduced to a white square. The array of pictures I had was set to be sprites, but Unity had no way of making a sprite object for me to assign to the variable I had made.
The Solution
The answer to my problem was much simpler than I had thought. All I had to do was set the sprite property of the Image object, and not the object itself. Instead of "image = array index', I had to use "image.sprite = array index". I'm slightly embarrassed at how simple it actually was, but that's programming for you.