Search Unity

'Tautvydas Zilys' - Requesting help from you from an old thread

Discussion in 'Windows' started by NinjaChris, Mar 5, 2016.

  1. NinjaChris

    NinjaChris

    Joined:
    Mar 5, 2016
    Posts:
    6
    Hello everyone, first time post so forgive me if I make any mistakes!

    Last May, there was a discussion made from Tautvydas Zilys and Krougeau regarding Transparent Unity Applications that also allow mouseclicks through to the Windows desktop.

    forum.unity3d.com/threads/solved-windows-transparent-window-with-opaque-contents-lwa_colorkey.323057/

    I've been using the code created by you all, and it has been working great, but I've been having a few problems and hoped for a bit of help.

    1.) I've been compiling my copy on Windows 10, which has worked for me, but when I run the application on *some* other computers, such as Windows 7/8, the backdrop sometimes won't work, depending on the computer. I'm trying to figure out what other software may be necessary to get it to work... I've tried installing the .NET 4.5 framework, installed the latest copy of Unity on that computer, and even recompiled/built a copy on the other computers. Nothing has worked. Any ideas on what might be missing?

    2.) I've also been looking for a correct, proper way to figure out how to 'turn off' the transparent window & allow mouse input to not go through the application when I switch levels/scenes. After a bunch of fiddling around (I have absolutely no idea at all how your code works), I was able to create a function that does the job, but I don't know *why*. Because this is such a custom application, I can't find any answers for this online either, but I'm also probably looking in the wrong places. Here's the function: http://pastebin.com/VCcJ0MM6, could you help me understand how the code works as well as how to disable the transparent window properly?

    Thanks a ton in advance!
    -Christopher
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Regarding 1) - what exactly doesn't work? How does it manifest?

    On 2):

    Call DwmExtendFrameIntoClientArea with zero margins. That should disable it.
     
  3. NinjaChris

    NinjaChris

    Joined:
    Mar 5, 2016
    Posts:
    6
    Hello! Thanks a bunch for the response!

    Alright, I'll add DwmExtendFrameIntoClientArea properly.

    As for point 1... Holy cow I thought I gave more detail.

    On my Laptop as well as about half of the desktops I run on (ranging from Windows 7 or Win 10 (No Win 8)), the backdrop works fine as expected.



    On other desktops however, instead of having the backdrop be invisible and can be clicked through, it simply is pitch black instead, as if the Unity application is just running a black image in the background. I haven't tested to see if the audio comes through like normal as I was more concerned about the visibility.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Is that video related? What am I supposed to be looking at?

    Is by any chance Aero disabled on the affected machines? Do you know what kind of hardware they're running?
     
  5. NinjaChris

    NinjaChris

    Joined:
    Mar 5, 2016
    Posts:
    6
    Hello again!

    Yes, the video is related. It's the current footage of the project running on my laptop. The text in black at the top, the logo in the bottom left corner & the scaling/fading icons are all the project. The game running in the background is League of Legends, running as a 'borderless window application', showing the Unity Project running atop of any game behind it. I really hope I'm not being confusing about this!

    I don't know about Aero being disabled! I will definitely check that out and get back to you. I also do not know the exact specs, but iirc it is running an nVidia video card. Will confirm asap though.

    Any other details of relevance I can get to you? Thank you for all the help!
     
  6. NinjaChris

    NinjaChris

    Joined:
    Mar 5, 2016
    Posts:
    6
    Well, that did it. I'm somewhat bitter that Windows Aero being disabled was the problem here. I had no idea that it had such an influence, but that is good to know.

    Also, for future knowledge, will an application like this (whether through your code or through Unity) require .NET framework installed on the computer? I don't know where or how I picked this up, but I believe I heard that .NET is needed for this kind of application.

    Thank you again. Truly.
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Applications that are made with Unity do not have any external dependencies, so no, you don't have to install the .NET framework.

    DwmExtendFrameIntoClientArea functionality actually depends on Aero being enabled, and that's the function that makes transparency possible.
     
  8. NinjaChris

    NinjaChris

    Joined:
    Mar 5, 2016
    Posts:
    6
    That's good to know and I will include it within the documentation right away.

    Thank you again. You're awesome! If this were Reddit I would gift you gold.

    -EDIT-

    Actually, I do have one more question for you. This one is a bit trickier, and I don't believe it to be possible.

    Is there a way to have keyboard input to be accepted within the application while it is not the primary window? As the application is meant to be run in the 'background', I have to alt-tab back into it to apply input. Is there any way for me to fix this?
     
    Last edited: Mar 8, 2016
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
  10. NinjaChris

    NinjaChris

    Joined:
    Mar 5, 2016
    Posts:
    6
    Ha, I have to say I was a bit worried about this as a potential solution. I'll follow that link and chew on it on my own, since it would be a bad idea to request info on how to make a keylogger for the world :p

    Thanks again. Hope you don't mind that I'll put you in the credits.