Search Unity

Menu and different pages with UI

Discussion in 'UGUI & TextMesh Pro' started by emrahakman, Sep 25, 2019.

  1. emrahakman

    emrahakman

    Joined:
    Dec 8, 2016
    Posts:
    7
    Hi, I'm not an advanced developer.

    I'm trying to build a UI design that includes some buttons (Player Profile, Characters, My stats..). Every button opens a new page, but not a new scene.

    For example, I just want to update some part of my main canvas. My full canvas size is 1280 x 720, but I want to update an area sized 1040 x 570 when buttons clicked (In the attachment, the blue area has to be updated when buttons on top are clicked.).

    Is there a way to do that? Or is there any keywords for me to search this problem right?

    Thanks.
     

    Attached Files:

  2. uMathieu

    uMathieu

    Unity Technologies

    Joined:
    Jun 6, 2017
    Posts:
    398
    emrahakman likes this.
  3. emrahakman

    emrahakman

    Joined:
    Dec 8, 2016
    Posts:
    7
    Sorry for posting in wrong forum. And thanks for information.
     
  4. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    Moving thread to uGUI forum..
     
    emrahakman likes this.
  5. Antistone

    Antistone

    Joined:
    Feb 22, 2014
    Posts:
    2,836
    That's a very general question. The very general answer is "when the button is clicked, change your UI objects in some way, depending on what you want them to do."

    But as a simple example, one common thing you might do would be to have a panel "on top" of your main UI that can appear and disappear depending on the situation. Go ahead and create that panel and everything you want to see inside of it as part of your Unity scene, making sure that there is a single "root" object that everything else descends from.

    Then, when you want to show or hide the panel, do something to the root object to make it visible or invisible. Some simple ways of doing that are:
    • Call SetActive(true/false) on the root object
    • Attach a Canvas Group to the root, then change its "alpha" value to control visibility and the "blocks raycasts" flag to control whether you can click it (this is useful if you want to animate it fading in/out, because you can set it to partial transparency if you want)
    • Move the root object somewhere that the camera can't see it (e.g. way off to the side) and back.
     
    emrahakman likes this.