Detect cursor or pointer is on ui element unity easy tutorial

Subscribers:
1,110
Published on ● Video Link: https://www.youtube.com/watch?v=q6dOBnDthww



Category:
Tutorial
Duration: 1:37
209 views
7


ASSALAM o alaikum Code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class PointerOverUI : MonoBehaviour
{

public Toggle toggle;

// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{

if (EventSystem.current.IsPointerOverGameObject())
{
toggle.isOn = true;
}
else
{
toggle.isOn = false;
}

}
}


/////////////////////////////////////////////////////////////////////////////////////////////
ASSALAM o alaikum
All codes and concepts and videos from this channel are non copyrighted and free to use because we believe that knowledge should be freely available for everyone
But kindly give those people credit whom I have given in description if you use their work
/////////////////////////////////////////////////////////////////////////////////////////////

Safar by ASHUTOSH
-----------------------------------------------------------------------------------------------------------------------------------
Track: ASHUTOSH - Time
https://soundcloud.com/grandakt
-------------------------------------------------------------------------------------------------------------------------------------
FREE DOWNLOAD:- https://soundcloud.com/grandakt/safar-produced-by-ashutosh-free-download







Tags:
unity
unity3d
learn unity
unity2d
unity tuorials
unity coding
unity programming
cursor on ui element in unity
detect cursor on ui element unity
detect cursor on ui element unity tutorial