3/17/2024 0 Comments Load a png as a texture![]() ![]() var obj Resources.Load('NumCard1') Debug.Log(typeof(obj)) If obj is not null, it would tell you what type it is. First you should try to check it like this. modules/gdscript/gdscript. Normally png would be imported as texture, not sprite. drivers/gles3/rasterizer_storage_gles3.cpp:836 texture_set_data()Į 0:00:24.465 load_source_code: Condition "err" is true. core/io/image_loader.cpp:56 load_image()Į 0:00:00.266 texture_set_data: Condition "!read.ptr()" is true. When you export your project my_project/icon.png won't be in exported into the pck file but only the file pointing to those converted files.Īnd some examples to load different files:Į 0:00:00.266 load_image: Error opening file '/storage/emulated/0/Pictures/cardgame/00000001.jpg'. For example, the path res://icon.png doesn't point to the file my_project/icon.png but it will read the file and this file will contain the path to the converted files something like my_project/.import/icon-47-.stex and my_project/.import/icon-12-.stex which are the files that the engine has created from your file and they are the ones that it will use at runtime. ![]() So a resource links a file with one or more converted files. In godot, imported resources aren't the same as files.Įxplanation on what godot does when you import a file here I'll try to explain it and hope that someone can unmess the mess I write □ I think we need to specify somewhere that imported resources aren't the same as files and how to load external files but I have no idea where. We need to explain them that those functions only work with imported files and what they should do to load external files. It's not the first time (and won't be the last) where an user tries to load an external file (a file that has not been imported) with load() or ResourceLoader.load() and gets confused because it doesn't load or it fails. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |