在Unity中,可以通过设置Camera的背景,Camera下的Environment下的Background Type设置为Solid Color,
Background需要设置黑色透明度0,即ARGB为(0,0,0,0)。透明度不为0则无法实现透明效果。
在打包时,player Settings设置Resolution and Presentation下的Render Over Native UI*勾选上。
安卓iOS那边需要重写styles.xml
如下:
<?xml version="1.0" encoding="utf-8"?>
<style name="custom_dialog" parent="@style/Theme.AppCompat.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:background">#00000000</item>
<item name="android:windowBackground">@android:color/transparent<