| | |
| | | // { |
| | | // spineComp.material = null; |
| | | // } |
| | | ResManager.Instance.LoadAssetAsync<Material>("Materials", "SkeletonGraphicDefault-Straight").ContinueWith(material => |
| | | var material = await ResManager.Instance.LoadAssetAsync<Material>("Materials", "SkeletonGraphicDefault-Straight"); |
| | | if (material != null) |
| | | { |
| | | if (material != null) |
| | | { |
| | | spineComp.material = material; |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError("Failed to load material for Spine effect: " + effectConfig.fxName); |
| | | } |
| | | }).Forget(); |
| | | spineComp.material = material; |
| | | #if UNITY_WEBGL && !UNITY_EDITOR |
| | | Debug.Log($"[SpineEffect][WebGL] effectId={effectConfig.id} fxName={effectConfig.fxName}" + |
| | | $" mat={material.name} shader={material.shader.name}" + |
| | | $" straightAlpha={material.IsKeywordEnabled("_STRAIGHT_ALPHA_INPUT")}" + |
| | | $" canvasGroup={material.IsKeywordEnabled("_CANVAS_GROUP_COMPATIBLE")}" + |
| | | $" pmaVert={spineComp.MeshGenerator.settings.pmaVertexColors}"); |
| | | #endif |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError("Failed to load material for Spine effect: " + effectConfig.fxName); |
| | | } |
| | | |
| | | spineAnimationState = spineComp.AnimationState; |
| | | spineAnimationState.TimeScale = speedRate; |
| | |
| | | spineComp.enabled = true; |
| | | PlayerTheSpineAnim(); |
| | | SoundPlayer.Instance.PlayUIAudioDelay(effectConfig.audio).Forget(); |
| | | |
| | | #if UNITY_EDITOR |
| | | // 编辑器模式下强制刷新材质球,解决部分特效不显示问题 |
| | | await UniTask.Delay(100); |
| | | if (spineComp != null && this != null && spineComp.material != null) |
| | | { |
| | | spineComp.material.shader = Shader.Find(spineComp.material.shader.name); |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | // 播放指定动画 |