11 years ago

A weird quirk with UnityUI and Screenshots


I was going through my screenshots for Starfire and I noticed something: the turn speed indicator wasn’t showing up!

5d0c6ebf2c0a6.png

It should be right below the radar, like this:

5d0c6ec015693.png

But for some reason, it wasn’t showing up! So I went into my code to figure out what was happening. Part of my screenshot code was trying to hide the GUI in Unity by finding the Canvas and hiding it. The problem with that though was that I had multiple canvases, so it was hiding the wrong canvas. I got rid of that code, but the GUI I wanted still wasn’t showing up.

Then I remembered that I take my screenshots at 2x resolution, which always made my game stutter. The interesting thing about that though, that I didn’t notice until after I turned off GUI hiding, is that the cockpit GUI stutters a bit when I take a screenshot.

The cockpit GUI is screen space: camera. That means that it is basically flying around with the camera, almost as if it is a child of the camera. The problem with this though, is that it lags a little bit behind the camera because it’s always playing catch-up with the camera. Normally this lag isn’t noticable, because everything updates so quickly that the one frame lag isn’t really that big of a deal.

However, when I do a screenshot, that lag is incredibly obvious. In other words, the GUI wasn’t showing because it hadn’t caught up with the camera yet. Obviously this wouldn’t do. So, I needed to fix that somehow. In the end, I fixed it by taking a 1x screenshot, which reduced the lag enough that the GUI lag wasn’t an issue.

Weird though, right?



0 comments

Loading...

Next up

Just as Pecaminosa's musicians #improvise this rendition of #LittleSunflower 🌻, so do we improvise with this post you're reading. 😂

What's coming out of your own improvs? 🤔

#Pecaminosa | #IndieDev | #OST | #Jazz

So

i may or may not make an full art of some person or i may just leave this like that-

🍒Did you like the game? A demo is available for free on Steam.

✌️ Thanks for playing IndieGameiacs!

⚙️ Free Demo: http://bit.ly/UniDuni

📺 Full Video: https://youtu.be/5qEbVXg7GaQ

#steam #uniduni #clops #screenshotsaturday

Update 2.627

New challenges & new effects!

Call it 'wrong turn'!🚫 The feeling of running into a house with only one exit🚪, and being doomed to die. #pixelart #pixelartist #pixelartwork #art #pixel #indiegame #IndieGameDev #indieartist

"Day to Day" (also check spud out here he's a great guy and writer: https://soundcloud.com/spudward)

it happens

A few screenshots of the places you'll cross in the Demo of Blu. You can play it today on #gamejolt !

OK, this starts to be too tricky puzzle already :D

#platformer #indiegame #puzzle

Out of boredom and curiosity, I coded Sailor Jupiter's Argentine Backbreaker.