Is it possible to just draw another invisible panel behind canvas with html?
style display: block; visible: false; something like this
Is it possible to just draw another invisible panel behind canvas with html?
style display: block; visible: false; something like this
This works for me with URP. Very simple!
I triedïŒbut need disable hdr
Hi,
I donât know much about web coding at all but I was wondering, where do I put this in the Index file? Iâm using URP.
Thanks,
Pete
A couple options:
Put that in a CSS file that your index.html file references like
<link rel="stylesheet" href="assets/mystyle.css">
Add it directly to the element in your index.html file, like
<canvas id="unity-canvas" width=312 height=256 tabindex="-1"
style="width: 312px; height: 256px; background: transparent;"></canvas>```
Awesome, thanks @gamedevjake !
just imported in in unity 2022 , it works thanks !
I sucess with URP and share my settings for someone need.
[Environment]
Unity 2021.3.15f1
WebGL
URP 12.1.8
Gamma Color Space
[Settings]
1.Base Camera
ăEnvironmentă
-ăBackground Typeăset Solid Color
-ăBackgroundăset RGBA(0,0,0,0)
2.URP
In UniversalRenderPipelineAsset set ăHDRă off
In UniversalRenderPipelineAsset_Renderer set ăPost-processingă off
3.Color Space
ăProject Settingsă-ăPlayeră-ăOther Settingsă-ăColor Spaceăset Gamma
4.html
set css
body{
background: transparent;
margin: 0px;
overflow: hidden;
}
unity-canvas{
background: transparent !important;
}
5.TransparentBackground.jslib
download TransparentBackground.unitypackage provided by Marks4
add to Assets/Plugins/ folder
[Demo]
In of black line means unity app
out of black line means web
Also adding for future reference (these steps worked for me, but the link to the jslib is gone so here it is in text form (working in URP unity 6):
It can be anywhere in your Assets folder with any name as long as it has the file extension .jslib
var LibraryGLClear = {
glClear: function(mask)
{
if (mask == 0x00004000)
{
var v = GLctx.getParameter(GLctx.COLOR_WRITEMASK);
if (!v[0] && !v[1] && !v[2] && v[3])
// We are trying to clear alpha only -- skip.
return;
}
GLctx.clear(mask);
}
};
mergeInto(LibraryManager.library, LibraryGLClear);