- Home /
My UI Buttons stopped working
My UI buttons worked until today, after I imported some Assets and played around with them all my UI Buttons on that scene stopped working. So I deleted all the imported Assets but the Buttons are still not working. When I switch scenes and play game it works perfectly. In my event system I've checked force Module Active in my Canvas > Gameobjects Interacble and Raycast Target is checked. I've double check the Event Trigger Script component and the coding, but nothing is working. I doubt there's anything wrong with the coding.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class Movement : MonoBehaviour {
public bool mouseOff = false;
public void MoveLeftButton(string moveleft)
{
Player.horizVel = -3;
}
public void MoveRightButton(string moveright)
{
Player.horizVel = 3;
}
public void MoveLeftButtonStop(string moveleftstop)
{
StopXVel();
}
public void MoveRightButtonStop(string moverightstop)
{
StopXVel();
}
public void OnPointerEnter(PointerEventData eventData)
{
MouseOffTrue();
}
public void OnPointerExit(PointerEventData eventData)
{
MouseOffFalse();
}
public void OnPointerDown(PointerEventData eventData)
{
MouseOffTrue();
}
void MouseOffTrue()
{
mouseOff = true;
}
void MouseOffFalse()
{
mouseOff = false;
}
void StopXVel()
{
Player.horizVel = 0;
}
}
Your answer
Follow this Question
Related Questions
Moving a ScrollRect child via script to focus on some point. 0 Answers
How to click and drag images into multiple slots? 0 Answers
How to link buttons to individual levels within the same scene? 1 Answer
Unity 2D Combat Text Issue With Multiple Enemies 2 Answers
How to get an array of all Buttons attached to a Panel? 2 Answers