How to set an .atex file to a Light2D in script?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By avencherus
:warning: Old Version Published before Godot 3 was released.

In Godot 2, I’ve run into an issue where if I assign an atlas texture using set_texture() on a Light2D node, it will use the whole texture, and not just the region.

var my_light = Light2D.new()
my_light.set_texture(preload("res://light_mask2.atex"))

Any suggestions on how to coax it to recognize the region coordinates?

Or are atlas textures not supported in this way?

It seems like AtlasTexture isn’t supported by Light2D for some reason, it doesn’t work when setting the texture from the Inspector either.

mollusca | 2017-12-30 09:54

Thanks for checking into it and finding that, I didn’t think to test it in the editor inspector, I am getting the same results there too. I suppose it is a bug after all.

I opened an issue for it: Light2D Texture doesn't properly use .atex files. · Issue #15194 · godotengine/godot · GitHub

avencherus | 2017-12-30 14:39