PDA

View Full Version : Minimalist interface with anchored buttons



Nanodatron
May 16th, 2017, 09:35 PM
Hello

I try to create a minimalist interface of teamspeak with only the possiblity to connect or disconnect (no custom server or nickname, only IN and OUT).

15541

There is only 2 buttons: connect and disconnect.

15542
That's the "connect" button (showing that actually it's disconnected)

15543
And that's the "disconnect" button (showing that it's actually connected)

I managed to do that with the example project, but i can't anchor those buttons for them to stay on top left of the screen when we change the resolution.

15544
Like you can see here.

The structure in the Hierarchy pannel don't allow me to move the buttons for being direct childs of the canvas (wich allow me then to use anchors on the buttons) because the script don't work anymore...

Could you advise me on how to add anchors to those buttons without the script to freak out?

Alex_G
May 24th, 2017, 07:44 AM
Hi Nanodatron,

Can you tell me exactly what you do and what happen?

And I need the error messages.

In general about your resolution problem, you need to take a look at the unity documentations.

https://docs.unity3d.com/Manual/HOWTO-UIMultiResolution.html

Regards

Alex G.

Nanodatron
May 25th, 2017, 01:37 PM
Hi Alex_G

I tried my best to explain in detail the problem earlier. I finally found a way to make it work. If anybody else have the same problem and recognise it in my description, here is a resume of how it can work:

- Create two new canvas at the root of the Hierarchy. One for the button "connection" and one for the button "connected"
- Very important: Set the tag of the new canvas "connection_pannel" to "con_01" and "connected_pannel" to "con_02"
- Next, select the game object: "TeamSpeakClientExample" and assign the 2 parameters "Connection_Pannel" and "Connected_Pannel" to our two new canvas (drag-drop the game objects on the field).
- Then select all the childrens inside the old "connection_pannel" and "connected_pannel", and move them as childrens of the new canvas.
- You can supress the 2 unused old ones
- NOW you can assign an anchor to each buttons, and not worry about what will happend when the resolution of screen will change.

I have another issue now, first i start to see on my side, and if i can't manage, i will create a new topic. Thanks :)