• 2D
  • Sprite stretch for full size

my game's stretchsettings run at mode: viewport aspect : expand

with this game run without deforming the ui. but i have few sprite animation that run at fullscreen size and when window size change (its mobile game, so its change a lot), sprites did not change and its expected because aspectis set the expand

i need the resize the sprites that run at fullscreen, stay at fullscreen even after window size changed, its okay even they are deformed a little, i can get the result with aspect : ignore but this one effect the whole game so ui and 3d space also bend around for screen. i only need the full screen sprites run at fullscreen. i did try something like this

	dark_screen_sprite.texture.get_size().y = get_viewport().size.y 
	dark_screen_sprite.texture.get_size().x = get_viewport().size.x 

viewport node render the 3dgame space with low resolution...

Yes, you have the right idea, but you are not actually changing the texture size (you are changing a temporary variable of the texture size, not the texture itself). And, in any case, you want to leave the texture alone. What you want to do is change the scale of the sprite. This will scale it to the full screen size (you cannot set the dimensions manually in x/y, though this would be useful).

You can do something like this:

dark_screen_sprite.scale = get_viewport().size / original_game_size

Where "original_game_size" is a Vector2 of the unscaled game (most likely what is set in the project settings under width / height of the window).

dark_screen_sprite.scale = get_viewport().size / Vector2(512,300)

thanks a lot, that solved the problem.