Set texture along the way

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GuilhermeA

Hello, how do I say to set the texture of my Sprite node by the image path? Can I also use external images that are saved locally, using their absolute path?

:bust_in_silhouette: Reply From: Brightlight studios

You can use

  var spath
  var sprite_texture = preload (spath)
  $Sprite.texture = sprite_texture

And by just changing spath you can now edit in your script, as for external files you can try using a file dialogue node to load images in game which I’m still battling with so can’t help much in that department.

I also wanted to be able to upload external files that are outside the res folder, when you can comment on this topic?

GuilhermeA | 2020-09-25 19:10

Well you can use the file dialog node which I don’t know much about but it should come in handy

Brightlight studios | 2020-09-26 18:07

Thanks, I was able to solve my problem

GuilhermeA | 2020-09-29 18:15