This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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?

in Engine by (26 points)

1 Answer

0 votes

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.
Cheers!!

by (76 points)

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

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

Thanks, I was able to solve my problem

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.