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

When starting the program, set the visible of texturerect or colorrect to true, and a problem occurs #101211

Open
huhonglei opened this issue Jan 7, 2025 · 1 comment

Comments

@huhonglei
Copy link

huhonglei commented Jan 7, 2025

Tested versions

My project needs exe transparency, so I set Transparent and per Pixel Transparency in project-General-Display to true, and my rendering mode is Compatibility. Now I will display some pictures after starting the program, so I set texturerect/colorrect's visible to true, but I found that after setting it to true, the transparency of texturerect/colorrect suddenly changed, and it returned to normal after less than 10 seconds. After testing it several times, I found that if I display the picture after 10 seconds, it will be normal. It seems that the godot engine is initializing something, and it will be fine after initialization (maybe related to rendering), because if I don't set transparent, there is no problem. Can anyone help me and tell me how to deal with it.

System information

Win11,godot4.3 C#

Issue description

20250107_143438.mp4

Steps to reproduce

I just pressed the A key when the program started to make the Icon appear
here is my code

public partial class NodeTest : Node
{
	private TextureRect _textureRect;
	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
        _textureRect = GetNode<TextureRect>("TextureRect");
        _textureRect.Texture = GD.Load<Texture2D>("res://icon.svg");

    }

	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
	}

    public override void _Input(InputEvent @event)
    {
        if (@event is InputEventKey keyEvent && keyEvent.Pressed)
        {
            if (keyEvent.Keycode == Key.A)
            {
                GD.Print("A was pressed");
                _textureRect.Visible = true;
            }

            if (keyEvent.Keycode == Key.S)
            {
                GD.Print("S was pressed");
                _textureRect.Visible = false;
            }
        }
    }
}

Minimal reproduction project (MRP)

see above

@AThousandShips
Copy link
Member

Please upload a complete minimal project to help testing and fixing this, and please check if it occurs in GDScript as well or only in C#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants