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

Hi i have CenterContainer and TextureRect, can i to resize TextureRect with container?

in Engine by (26 points)

i want resize TextureRect to 80% of CenterContainer

1 Answer

0 votes

Here's one solution :

1- Attach a script to your TextureRect.
2- Connect your CenterContainer's "resized()" signal to your TextureRect
(Click on your CenterContainer and check the "Node" panel)
3- Then on your newly created function, add :

func _on_CenterContainer_resized():
    rect_min_size = get_parent().rect_min_size * 0.8

Your function name may differ if you named your CenterContainer otherwise
4- On your TextureRect, Check the "expand" box just below the texture.

Then as you change your CenterContainer's min_size (or size, you'll have to adapt a bit), your TextureRect should adapt

by (22 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.