Unity 2021.3.5f1 (40eb3a945986)
Spine runtime spine-unity unitypackage (spine-unity-4.1-2023-01-11)
I build spine file to assetbundle file.
(Default shader is Spine/Skeleton
)
I add spine component in script C#
- I have omitted most of the code and only posted the key codes
// assetbundle load releated:
Material materialPropertySource = new Material(Shader.Find("Spine/SkeletonGraphic"));
materialPropertySource.SetInt("_CanvasGroupCompatible", 1);
SpineAtlasAsset runtimeAtlasAsset = SpineAtlasAsset.CreateRuntimeInstance(atlasAsset, textures.ToArray(), materialPropertySource, true);
runtimeSkeletonDataAsset = SkeletonDataAsset.CreateRuntimeInstance(dataAsset, runtimeAtlasAsset, true);
.....
// create spine el
skelG = spine.AddComponent<SkeletonGraphic>();
skelG.allowMultipleCanvasRenderers = false;
skelG.material = new Material(Shader.Find("Spine/SkeletonGraphic"));
skelG.material.SetInt("_CanvasGroupCompatible", 1);
...parent canvas group set alpha to 0.7
Yes, in unity editor preview is fine.
But when built app, it's not good. (Too bright, I think this is due to the fact that it is not enable CanvasGroup Compatible
)
And I tested web preview (phaser3)
Even I set material.SetInt("_CanvasGroupCompatible", 1);
I know it's about CanvasGroup Compatible
not enable, but I don't know missing what?
I also check Spine/Runtime/spine-unity/Materials/SkeletonGraphicDefault.mat
default is disable (I also tested default enable it, still not work)