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

Been working lately on lots of 'behind-the-scenes' boring stuff that no one really cares about, so here’s a guy playing the sax for some reason.

#screenshotsaturday

Finished a project I've been working on over the last few days!

Modeled and textured in Blender.

#3dart #lowpoly #npbr #fantasy #hut

Microsoft Windows XP Unprofessional (windows logo prototype)

Spaaaace~

These are background sprites I've created for a game I'm working on at school ^w^ Click on the post to see how the sprites connect. You won't regret it! (personally, I think it's pretty heheh)

Drawn in Piskel using my mouse. Whaddya think?

If you have more of an acquired taste, the restaurants in Niravasi have you covered! Maybe skip the salad bar, though.

Only true badasses may pass! #conceptart #art #gamedesign

Explosive domino effect

We're knee deep in multiple large features and "game feel". Quick peek behind the scenes in this weeks Dev Blog: https://bit.ly/2QmmaQM

Coming Soon...