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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Bug Buttons not working

Discussion in 'Linux' started by kawales, Sep 23, 2015.

  1. kawales

    kawales

    Joined:
    Jul 4, 2014
    Posts:
    5
    Hello! I've been making a small 2D mobile game on my windows 8 OS. Because I don't use winodws that much and I saw that the Linux version is testable I ported my project to it ( I have a backup of it tho). When I loaded it in the buttons weren't working anymore in the editor, I tried new buttons to a new canvas but they didn't work too.
    Unity doesn't crash or anything when I try pressing them tho, it just threats them like images.
    Version: 5.1.0f3 Screenshot from 2015-09-23 16:12:21.png
     
  2. milgar_

    milgar_

    Joined:
    Mar 2, 2014
    Posts:
    14
    Buttons working fine for me. Im using the latest build.
     
  3. kawales

    kawales

    Joined:
    Jul 4, 2014
    Posts:
    5
    was it maybe because I have 5.0.2 on my windows?
     
  4. milgar_

    milgar_

    Joined:
    Mar 2, 2014
    Posts:
    14
    You could try creating a new project and then test button.
     
  5. alijib

    alijib

    Joined:
    Nov 14, 2014
    Posts:
    17
    yes. buttons aren't working. I made a thread for it.
     
    kawales likes this.
  6. kawales

    kawales

    Joined:
    Jul 4, 2014
    Posts:
    5
    Tried that didn't work
     
  7. kawales

    kawales

    Joined:
    Jul 4, 2014
    Posts:
    5
    Update: I installed the first build again( I meant the first experimental build that we were given) and here the buttons also don't work until you siwtch it to another platform, where in the last one not even that would help.
     
  8. Chaoseiro

    Chaoseiro

    Joined:
    Aug 28, 2013
    Posts:
    40
    kawales likes this.
  9. Kaukamieli

    Kaukamieli

    Joined:
    Jul 14, 2015
    Posts:
    15
    Most probably the mouse offset. To fix, try to make the game window exactly as big as the actual game area inside it, so there is no empty space on top/bottom, or left/right. Buttons work really well for me... except that they don't appear in my webgl build at all, but that's another issue...
     
    kawales likes this.
  10. milgar_

    milgar_

    Joined:
    Mar 2, 2014
    Posts:
    14
    Might be. I have only used free aspect till now. But if i change it to 4:3 everything goes haywire.
     
  11. RubenD056

    RubenD056

    Joined:
    Nov 18, 2015
    Posts:
    1
    Could also create a script yourself to act as a button, although I have only tested it with the Text class, created a very simple one and it worked. I'm using UnityEditor Beta 5.5 in Manjaro Linux. Here's the script:

    using UnityEngine;
    using UnityEngine.UI;
    using System.Collections;


    public class ButtonCustom : MonoBehaviour{
    public RectTransform rt;
    public Text text;
    public Color highlited = Color.white;
    private Color startColor;
    private Rect rectangle;
    void Start(){
    startColor = text.color;
    }
    void Update(){
    rectangle = rt.rect;
    Vector3 mPos = Input.mousePosition;
    if(mPos.x>rt.position.x-(rectangle.width/2) && mPos.x<rt.position.x+(rectangle.width/2)){
    if(mPos.y>rt.position.y-(rectangle.height/2) && mPos.y<rt.position.y+(rectangle.height/2)){
    text.color=highlited;
    }else
    text.color=startColor;
    }else
    text.color=startColor;
    }
    }