简体   繁体   English

如何使用通用渲染管道 (URP) 在 Unity 中获得透明游戏 window?

[英]How can I get a transparent game window in Unity using Universal Render Pipeline (URP)?

In the past, in Unity, you could use DwmExtendFrameIntoClientArea in Unity to get a transparent game window drawn on top of the desktop, making all game objects appear on the desktop itself.过去在Unity中,你可以在Unity中使用DwmExtendFrameIntoClientArea来得到一个透明的游戏window绘制在桌面之上,使所有游戏对象出现在桌面本身。 This was done using the legacy render pipeline.这是使用旧版渲染管道完成的。

Reference: https://forum.unity.com/threads/solved-windows-transparent-window-with-opaque-contents-lwa_colorkey.323057/page-2参考: https://forum.unity.com/threads/solved-windows-transparent-window-with-opaque-contents-lwa_colorkey.323057/page-2

Now, I have an app built in URP and I'd like to achieve the same effect but have no clue how to do it.现在,我有一个内置于 URP 的应用程序,我想达到相同的效果,但不知道该怎么做。 Downgrading to legacy render pipeline is not really an option as it is legacy at this point.降级到传统渲染管道并不是一个真正的选择,因为它在这一点上是传统的。

Anyone know how to achive a transparent game window drawn on top of the desktop using URP?有谁知道如何使用URP在桌面上绘制透明游戏window? If it helps, I only need it to work in Windows 10.如果有帮助,我只需要它在 Windows 10 中工作。

Thanks.谢谢。

Edit -> Player Settings -> Player -> Resolution and Presentation -> UNCHECK Use DXGI Flip Model Swapchain for D3D11编辑 -> 播放器设置 -> 播放器 -> 分辨率和演示文稿 -> 取消选中Use DXGI Flip Model Swapchain for D3D11

It is checked by default in URP projects, and it breaks up the WinAPI hack you mention in your post.在 URP 项目中默认检查它,它分解了您在帖子中提到的 WinAPI hack。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM