Frustration with images and sprites
Ferrum Cerebrum » Devlog
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.
Ferrum Cerebrum
Two bodies. One mind.
Status | Prototype |
Author | GoldMoonStudio |
Genre | Shooter, Action |
Tags | Mechs, Virtual Reality (VR) |
More posts
- Pictures disappeared after building projectJan 29, 2024
- Volume value was uselessJan 19, 2024
- Recovering from being sickJan 17, 2024
- Respawning after changing loadout problemDec 13, 2023
- Game over and pause menu conflictDec 08, 2023
- HUD window transparency issueDec 01, 2023
- Health component confusionNov 24, 2023
- Credits animation confusionNov 17, 2023
- Level select brokenNov 09, 2023