当前位置:网站首页>Unity3D Button mouse hover enter and mouse hover exit button events
Unity3D Button mouse hover enter and mouse hover exit button events
2022-07-31 02:40:00 【java can fly】
Requirements
Because Party A's acceptance failed, the project needs to be revised. When modifying the interface, I want to realize the function of displaying the second-level menu by hovering the mouse over the first-level menu. The main picture is as follows
Note that the mouse in the above picture is only hovering over the scene roaming button, and there is no left or right click, etc.
Implementation method
The idea is to let the class inherit the two interfaces of IPointerEnterHandler and IPointerExitHandler, and then implement the methods.
The code is as follows:
using System.span>Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;using UnityEngine.EventSystems;public class ScentRoamButtonControl : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler{/// /// Buttons for all scene walkthrough modules/// public GameObject SceneButtons;public void OnPointerEnter(PointerEventData eventData){//throw new System.NotImplementedException();//Debug.Log("111");SceneButtons.SetActive(true);}public void OnPointerExit(PointerEventData eventData){//throw new System.NotImplementedException();SceneButtons.SetActive(false);}}边栏推荐
- 19. Support Vector Machines - Intuitive Understanding of Optimization Objectives and Large Spacing
- 开题报告之论文框架
- 15、网站统计数据
- How to do a startup CTO?
- CentOS7下mysql5.7.37的安装【完美方案】
- mysql 视图
- 力扣刷题之爬楼梯(7/30)
- STM32CUBEMX开发GD32F303(11)----ADC在DMA模式下扫描多个通道
- try-catch中含return
- Clustering index, and what is the difference between a clustering index
猜你喜欢
随机推荐
print task sorting js od huawei
多线程下类对象的服务承诺探讨
ShardingJDBC usage summary
19. Support Vector Machines - Intuitive Understanding of Optimization Objectives and Large Spacing
TCP/IP四层模型
golang GUI for nuxui — HelloWorld
全流程调度——MySQL与Sqoop
Huawei od dice js
LeetCode 1161 The largest element in the layer and the LeetCode road of [BFS binary tree] HERODING
知识蒸馏7:知识蒸馏代码详解
Force buckled brush the stairs (7/30)
Drools Rule Properties, Advanced Syntax
Intranet Infiltration - Privilege Escalation
ShardingJDBC使用总结
Live Preview | KDD2022 Doctoral Dissertation Award Champion and Runner-up Dialogue
BAT can't sell "Medical Cloud": Hospitals flee, mountains stand, and there are rules
tcp框架需要解决的问题
系统需求多变如何设计
String为什么不可变?
mycat的主从关系 垂直分库 水平分表 以及mycat分片联表查询的配置详解(mysql5.7系列)









