You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Strange error when changing Spotlight3D Projector texture during runtime, but not during _ready(): ; texture_remove_from_decal_atlas: Parameter "t" is null.
#93516
Very strange issue when changing Spotlight Projector texture to a different texture during runtime.
Setting the texture in _ready() works fine, but changing the texture after that throws an error, however, it does change the texture and does not crash.
error in question: E 0:00:02:0198 texture_remove_from_decal_atlas: Parameter "t" is null.
<C++ Source> servers/rendering/renderer_rd/storage_rd/texture_storage.cpp:2745 @ texture_remove_from_decal_atlas()
Expected:
No error when changing textures
Got:
Strange error when changing textures
Steps to reproduce
Add a spotlight to your scene
Have a script with a function that changes the spotlight's texture
Press specified button (in my test project it's ui_accept)
After thinking the code through a bit, I found the the reason this happens (roughly):
On the change the old texture loses its last reference (RefCounted), and some internal of Light3D still using this will run into a missing reference because the reference already got cleaned up
So the fix would be keeping the current texture in memory by holding it in a var before changing light_projector to a new value or in this example it would also work to (pre)load the textures into the image1 and image2 vars (or an array) like
var image1 = preload("res://bobr.png") var image2 = preload("res://hegodh.png")
Tested versions
My version:
v4.2.1.stable.official [b09f793]
System information
Godot v4.2.1.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 (NVIDIA; 31.0.15.5222) - Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz (16 Threads)
Issue description
Very strange issue when changing Spotlight Projector texture to a different texture during runtime.
Setting the texture in _ready() works fine, but changing the texture after that throws an error, however, it does change the texture and does not crash.
error in question: E 0:00:02:0198 texture_remove_from_decal_atlas: Parameter "t" is null.
<C++ Source> servers/rendering/renderer_rd/storage_rd/texture_storage.cpp:2745 @ texture_remove_from_decal_atlas()
Expected:
No error when changing textures
Got:
Strange error when changing textures
Steps to reproduce
Minimal reproduction project (MRP)
BugReproduction.zip
The text was updated successfully, but these errors were encountered: