0 votes

For some reason, the folowing code works on Godot 2.1.4:

func _ready():

var a = load("/home/username/images/image.jpg")
print(a)
pass

returns:
[ImageTexture:555]

But on Godot 3.0 the same would return a [Object:Null]
even if i use ResourceLoader.load()

What changed?

(Running on Ubunut Mate 17.10)

in Engine by (12 points)

I am facing the same issue too and definitely need this feature !

As stated by @ QuentinCaffeino and following this link :

http://docs.godotengine.org/en/3.0/getting_started/workflow/assets/importing_images.html

In Godot 3+, image files are no longer native resources and they must be imported. The reason behind this is the large amount of configuration parameters that image files can be imported with.

This doesn't make sense, so we can't load pictures / textures downloaded from the internet to the phone ? or loading pictures from phone gallery upon run-time ?

Would appreciate if anybody has a solution / hack for this issue.

Thx in advance

2 Answers

0 votes

Because godot3 can't load images without import files.
I don't understand it either. Import files are generated when you import image in engine or place your image in game-dev directory and have engine opened.

by (54 points)
0 votes

I found this thread that worked for me (Should work for you too):

https://godotengine.org/qa/23713/how-to-convert-image-to-texture

The answer in the thread is Windows based (F:/pictures/) but worked for me on Ubuntu 16.04 LTS

by (892 points)
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.