Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a new ImageTexture by script fail, something to do with the size of the image #63172

Closed
Hannyson opened this issue Jul 18, 2022 · 1 comment
Labels

Comments

@Hannyson
Copy link

Godot version

4.0.alpha12

System information

Linux (Archlinux)

Issue description

Creating an imagetexture, and initialize it with an image created by a script fails. After initialization, the image size is still Vector2(0, 0). Setting it with set_size_override put the size right, but the image still can't be shown, error "Condition "!tex" is true".

Steps to reproduce

Write a script that creates an imageTexture initialized by an image also created by script, set it via this script to a TextureRect or something else.

Minimal reproduction project

BugImageToTexture.zip

@Chaosus
Copy link
Member

Chaosus commented Jul 19, 2022

You should use static method ImageTexture.create_from_image (without using a ImageTexture.new() constructor). Same reason why #63131 happened and it will fixed in docs by #63127

@Chaosus Chaosus marked this as a duplicate of #63131 Jul 19, 2022
@Chaosus Chaosus closed this as completed Jul 19, 2022
@Chaosus Chaosus marked this as not a duplicate of #63131 Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants