![]() ![]() I found some example code on the MSDN forums, but I'm having trouble ferreting out just how to use it through Unity. If that is the case, I need to have Windows set the background color, not Unity. I've got a feeling that Windows itself really doesn't notice or care what colors my Unity background is set to, and that it's probably only interested in what Windows sees. I had what I'd hoped was a "Eurkea!" moment last night, but implementation is proving difficult. Update: For additional reference, here is the documentation on the SetLayeredWindowAttributes function on MSDN: (v=vs.85).aspx Since my case is Unit圓D specific, I was really hoping that someone here might be able to point me in the right direction. I have also posed my question over at, though that post hasn't been approved yet and may not ever be. This is my first attempt to make use of an external DLL or the Windows API, and so I'm at a loss as to just what I might be doing wrong. I have a feeling I'm simply implementing it incorrectly, but I've been unable to find any working examples for Unity, and the Windows examples I've found are, of course, full of other information that may or may not be relevant. Some threads I've read also suggested using UpdateLayeredWindow in place of SetLayeredWindowdAttributes, but my results were the same with either. I'm fairly certainly I have these values right & will kick myself viciously if it turns out to be a simple matter of incorrect color choice, haha That said, I have tried several other colors, all with the same results.įrom everything I've read, the green color _should_ be being used as a transparency color, so it shouldn't be rendered at all. My camera's Solid Color is RGBA (0, 255, 0, 0), or 0x0000FF00 as the Windows specific code would have it. Unfortunately, using LWA_COLORKEY and Green as my color, gives me the following results (see next image). What I'm aiming for is to have a completely clear window by setting my camera's background color to a specific solid color and using LWA_COLORKEY to make _just_ that color transparent, which would, ideally, leave my kitty 100% visible with no transparent parts, much like chromakeying video. It's not as noticeable, but the window itself is also semi-transparent (with a black background in these examples) and slightly darkens the desktop behind them. While the first image may look alright at first glance, the second illustrates how the window's contents (the kitty) are also transparent. Here is the closest to "working" that the idea has come, using LWA_ALPHA in the SetLayeredWindowAttributes code: ![]() I'm not looking for any irregular window shapes, just a fullscreen, transparent rectangle. Hey there! Thanks for responding I'll go you one better and show screenshots of what I'm actually doing (desktop icons intentionally blurred 'cause who cares what I have on my desktop, right?). I've included richyrich's altered code & his usage instructions below for your consideration. However it might be achieved, I'd ultimately like to make the main window 100% transparent whilst keeping the contents of the window (gameobjects, GUI elements, etc.) 100% visible. I'm fairly new to coding, and know little at all about MSDN and the Windows API, but I really thought that LWA_COLORKEY would be the way to go, which has made the evening's repeated failures quite frustrating. Trying LWA_COLORKEY, which _should_ act more like chromakeying in video, has so far failed utterly and the window remains fully opaque. My tests with LWA_ALPHA are working well for making the window semi-transparent, but the content's themselves are also semi-transparent as LWA_ALPHA affects the entire window. While this is certainly a step in the right direction towards what I'm trying to achieve, I was curious if any of you might suggest how to make the window itself transparent while keeping it's contents opaque (preferably 100% visible)? Please see my second post, below, for example screenshots.Īfter viewing the information at &, I have managed to produce a semi-transparent window with semi-transparent contents. In short: How would I alter the example code below to use LWA_COLORKEY to achieve a transparent window with opaque contents, assuming that my Camera is set to clear a Solid Color (in this case, Green). Moved from the Scripting forums as this seemed the better, proper place for such a question: ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |