Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

UI elements such as buttons do not become interactive.

Discussion in 'UGUI & TextMesh Pro' started by moynzy, Feb 27, 2015.

  1. moynzy

    moynzy

    Joined:
    Oct 22, 2014
    Posts:
    82
    upload_2015-2-27_2-31-53.png
    The buttons in system options work fine, but in Characters, the plus buttons do not work in "characters".

    upload_2015-2-27_2-33-56.png
    I do have two canvases, a world space and overlay. Graphic raycast for both is turned on.

    No canvases have canvas group attached either.

    Only "Options", and "CharUI" have a canvas group attatched, since they appear by pressing C and O.
    upload_2015-2-27_2-36-39.png

    I've made sure they're intractable.

    Still my charUI is not responding.

    Any thoughts?
     

    Attached Files:

  2. moynzy

    moynzy

    Joined:
    Oct 22, 2014
    Posts:
    82
    Code (CSharp):
    1.         if (Input.GetKeyUp("c"))
    2.         {
    3.  
    4.             if (cgCharScreen.alpha == 0)
    5.             {
    6.                 cgCharScreen.alpha = 1;
    7.                 cgCharScreen.interactable = true;
    8.                 Experience.updateHealthStaminaExpAndCharacter();
    9.                 characterScreen.transform.position = charStarPos;
    10.  
    11.             }
    12.             else
    13.             {
    14.                 cgCharScreen.alpha = 0;
    15.                 cgCharScreen.interactable = false;
    16.             }
    17.  
    18.         }
    here is the code that makes the charScreenUI appear and disappear, you can see that I also make sure that it's intractable and visible when the player presses the C button.
     
  3. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,683
    Do you have a separate camera for your World Space canvas? If you don't then it should take inputs from your Main Camera, however if it is positioned incorrectly in the scene it may not work.

    For best results, give the world space canvas it's own camera. A great example of this is in the UI Samples asset that UT provide on the store:
    https://www.assetstore.unity3d.com/en/#!/content/25468
     
  4. moynzy

    moynzy

    Joined:
    Oct 22, 2014
    Posts:
    82
    You are a very active member, I appreciate your posts regarding my other threads. They've helped.

    The thing is, I'm using one main camera. I'll download the asset and experiment and learn.

    I don't understand why my ui elements become non responsive though. Hopefully I find out.
     
  5. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,683
    A world camera is tricky because the camera that is used to send raycasts out to detect interaction with the UI is very important. Whether it is the main camera or a separate UI camera, take a fair amount of tinkering to understand.

    P.S.
    The reason I'm so active in the UI forums should be evident in my signature :D
     
    moynzy likes this.