New GUI: How to do Button/Text optimized for each Resolution?

Hello, I have a question how to do Button or Text optimized for each Resolution in New GUI?
Thanks!

If you mean that you want the same size for each resolution, you need to add a Reference Resolution component to your canvas.

Edit: You should ask those questions in this forum:

Yes. I know about this, But I don’t know how to do with Reference Resolution component to every Resolution.
Anyway thanks.

I don’t understand what you are trying to achieve. Do you want a pixel perfect solution for certain resolutions? Do you want that the elements are correctly placed even if you have different resolutions?

I want to do Button or Text to the same size and position for each Resolution, But I do not know how to do it with “Reference Resolution”, But I tried and it didn’t work.

Sorry for my bad English.

What do you mean with the “same size”? The same physical size or the same size relative to the screen size (e.g. 10% of the screen size)?

Yes, Look:

How to do the GUI adjusted for each Resolution?

Using Matrix4x4 on GUI.

(Original) Dimensionar GUI automáticamente - (English traduction) Sizing GUI automatically

Thanks! It will work with the New GUI (Unity 4.6)?

No, it is only for the old GUI.

Check the videos to understand how you can achieve it. In your case, you may e.g. use a reference resolution to have a consistent height. Then you just need to anchor the UI elements correctly to the left and right side of the screen, as shown here:

https://www.youtube.com/watch?v=FeheZqu85WI

Why not? Matrix4x4 is same object in old and new Unity version.

Using Matrix4x4 you don’t need resize Rect object, or calculate its new position.

Matrix4x4 does it for you, using a reference resolution also to calculate Matrix4x4 scale.

Ok, it may work with the new GUI as well, but there is no reason to use it, because there is already a Reference Resolution script, specifically made for the new GUI. The problem is not the scaling or resolution, but the anchoring.

Okay, I’ll use Reference Resolution but What I need to set at Resolution X:Y in component?

What I did:
private void Awake()
{
GameObject.Find(“Canvas”).GetComponent().resolution = new Vector2(Screen.width, Screen.height);
}

And It doesn’t work.

Sorry for my bad English again, I hope you understand.

Just use the default values for now.

Thank you!