Unity 2021.3.16f1
URP 12.1.8 - URP 2D Renderer
Spine runtimes - Package version: spine-unity-4.1-2023-01-11.unitypackage
So I have this RenderTexture fadeout set up and works as intended in editor's Play mode. Console is squeaky clean as well.
But in Windows x64 Development build this happens:
No fade out is happening and I get the following errors:
ArgumentNullException: Value cannot be null.
Parameter name: shader
at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader)
at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00008] in C:\build\output\unity\unity\Runtime\Export\Shaders\Material.bindings.cs:18
at Spine.Unity.Examples.SkeletonRenderTexture.CreateQuadChild () [0x00108] in C:\GameDev\Dungeon Tavern\Assets\Spine Examples\Scripts\Sample Components\SkeletonRenderTexture\SkeletonRenderTexture.cs:93
at Spine.Unity.Examples.SkeletonRenderTexture.Awake () [0x00052] in C:\GameDev\Dungeon Tavern\Assets\Spine Examples\Scripts\Sample Components\SkeletonRenderTexture\SkeletonRenderTexture.cs:73
UnityEngine.GameObject:SetActive(GameObject, Boolean)
DungeonTavern.CharacterAnimationController:SetStairSkeleton(Int32, Int32) (at C:\GameDev\Dungeon Tavern\Assets\_Project\Scripts\CharacterAnimationController.cs:212)
DungeonTavern.CharacterMover:ShowStairSkeleton() (at C:\GameDev\Dungeon Tavern\Assets\_Project\Scripts\CharacterMover.cs:91)
DungeonTavern.<<Move>g__MoveCoroutine|0>d:MoveNext() (at C:\GameDev\Dungeon Tavern\Assets\_Project\Scripts\CharacterMover.cs:191)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (at C:\build\output\unity\unity\Runtime\Export\Scripting\Coroutines.cs:17)
(Filename: C:/build/output/unity/unity/Runtime/Export/Shaders/Material.bindings.cs Line: 18)
ArgumentNullException: Value cannot be null.
Parameter name: shader
at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader)
at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00008] in C:\build\output\unity\unity\Runtime\Export\Shaders\Material.bindings.cs:18
at Spine.Unity.Examples.SpineRenderTexture.CreateQuadChild () [0x00108] in C:\GameDev\Dungeon Tavern\Assets\_Project\Scripts\Fadeout\SpineRenderTexture.cs:93
at Spine.Unity.Examples.SpineRenderTexture.Awake () [0x00052] in C:\GameDev\Dungeon Tavern\Assets\_Project\Scripts\Fadeout\SpineRenderTexture.cs:73
UnityEngine.Behaviour:set_enabled(Behaviour, Boolean)
Spine.Unity.Examples.SkeletonRenderTextureFadeout:OnEnable() (at C:\GameDev\Dungeon Tavern\Assets\Spine Examples\Scripts\Sample Components\SkeletonRenderTexture\SkeletonRenderTextureFadeout.cs:66)
UnityEngine.GameObject:SetActive(GameObject, Boolean)
DungeonTavern.CharacterAnimationController:EnableSecondSkeleton() (at C:\GameDev\Dungeon Tavern\Assets\_Project\Scripts\CharacterAnimationController.cs:242)
DungeonTavern.<>c__DisplayClass29_0:<ShowStairSkeleton>b__1() (at C:\GameDev\Dungeon Tavern\Assets\_Project\Scripts\CharacterMover.cs:101)
DG.Tweening.Tween:OnTweenCallback(TweenCallback, Tween) (at D:\DG\_Develop\__UNITY3_CLASSES\_Holoville\__DOTween\_DOTween.Assembly\DOTween\Tween.cs:298)
DG.Tweening.Sequence:ApplyInternalCycle(Sequence, Single, Single, UpdateMode, Boolean, Boolean, Boolean) (at D:\DG\_Develop\__UNITY3_CLASSES\_Holoville\__DOTween\_DOTween.Assembly\DOTween\Sequence.cs:344)
DG.Tweening.Sequence:DoApplyTween(Sequence, Single, Int32, Int32, Boolean, UpdateMode) (at D:\DG\_Develop\__UNITY3_CLASSES\_Holoville\__DOTween\_DOTween.Assembly\DOTween\Sequence.cs:266)
DG.Tweening.Sequence:ApplyTween(Single, Int32, Int32, Boolean, UpdateMode, UpdateNotice) (at D:\DG\_Develop\__UNITY3_CLASSES\_Holoville\__DOTween\_DOTween.Assembly\DOTween\Sequence.cs:157)
DG.Tweening.Tween:DoGoto(Tween, Single, Int32, UpdateMode) (at D:\DG\_Develop\__UNITY3_CLASSES\_Holoville\__DOTween\_DOTween.Assembly\DOTween\Tween.cs:266)
DG.Tweening.Core.TweenManager:Update(Tween, Single, Single, Boolean) (at D:\DG\_Develop\__UNITY3_CLASSES\_Holoville\__DOTween\_DOTween.Assembly\DOTween\Core\TweenManager.cs:569)
DG.Tweening.Core.TweenManager:Update(UpdateType, Single, Single) (at D:\DG\_Develop\__UNITY3_CLASSES\_Holoville\__DOTween\_DOTween.Assembly\DOTween\Core\TweenManager.cs:417)
DG.Tweening.Core.DOTweenComponent:Update() (at D:\DG\_Develop\__UNITY3_CLASSES\_Holoville\__DOTween\_DOTween.Assembly\DOTween\Core\DOTweenComponent.cs:75)
(Filename: C:/GameDev/Dungeon Tavern/Assets/_Project/Scripts/CharacterAnimationController.cs Line: 242)
After the above problem when repeatedly trying to fade the RenderTexture, it becomes pink and throws the following error:
NullReferenceException: Object reference not set to an instance of an object
at Spine.Unity.Examples.SkeletonRenderTexture.AssignMeshAtRenderer () [0x00013] in C:\GameDev\Dungeon Tavern\Assets\Spine Examples\Scripts\Sample Components\SkeletonRenderTexture\SkeletonRenderTexture.cs:186
at Spine.Unity.Examples.SkeletonRenderTextureBase.AssignAtQuad () [0x00293] in C:\GameDev\Dungeon Tavern\Assets\Spine Examples\Scripts\Sample Components\SkeletonRenderTexture\SkeletonRenderTextureBase.cs:158
at Spine.Unity.Examples.SkeletonRenderTexture.RenderOntoQuad (Spine.Unity.SkeletonRenderer skeletonRenderer) [0x0000f] in C:\GameDev\Dungeon Tavern\Assets\Spine Examples\Scripts\Sample Components\SkeletonRenderTexture\SkeletonRenderTexture.cs:123
at Spine.Unity.SkeletonRenderer.LateUpdateMesh () [0x003cd] in C:\GameDev\Dungeon Tavern\Assets\Spine\Runtime\spine-unity\Components\SkeletonRenderer.cs:576
at Spine.Unity.SkeletonRenderer.LateUpdate () [0x00022] in C:\GameDev\Dungeon Tavern\Assets\Spine\Runtime\spine-unity\Components\SkeletonRenderer.cs:458
at Spine.Unity.SkeletonAnimation.LateUpdate () [0x0001a] in C:\GameDev\Dungeon Tavern\Assets\Spine\Runtime\spine-unity\Components\SkeletonAnimation.cs:274
(Filename: C:/GameDev/Dungeon Tavern/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs Line: 186)
The example scene for RenderTexture fadeout is working as intended in build, so I guess something is wrong with my setup? But I'm using the Runtimes components and setup should be identical besides the fact that the fadeout object is initially disabled:
This is how I trigger the start of the fadeout by enabling the SkeletonRenderTextureFadeout component:
_firstSkel.gameObject.SetActive(true);
var fadeout = _firstSkel.GetComponent<SkeletonRenderTextureFadeout>();
fadeout.enabled = true;
I'm going to work on a minimal reproduction project, but I'd appreciate if you have any ideas until I can put it together.