当前位置:网站首页>Unity 3D model operation and UI conflict Scrollview
Unity 3D model operation and UI conflict Scrollview
2022-06-30 05:08:00 【zjh_ three hundred and sixty-eight】
( The second solution has been updated , The second scheme is the best )
Old title :Scrollview And drag and drop the 3D scene model slide Roller Conflict
===================================================================
Problem description : The following figure shows my screen interface layout , Sliding ScrollView When the component , It will be linked to the operation function of the model at the same time .

Solution : In the model operation script , Add a judgment to the corresponding operation method :
Mouse version :if(Input.mousePosition.x < Screen.width * 0.75f){...}
Touch screen version :if(gesture.position.x < Screen.width * 0.75f){...}Plan ideas : Partition the operation according to the screen , That is, the 3D scene area on the left has an effect on the operation of the model , So add judgment and let it in 75% Zone operation is valid ( The lower left corner is the screen resolution 0 spot ), The specific percentage is divided according to the interface layout area , So as to shield the influence of the operation on the right side on the 3D scene .
summary : This solution has a limited scope , If ScrollView Components are used as the UI, This method is not applicable , Perhaps we can use ray judgment to solve , And other methods to be explored .
=============================== Split line ================================
Solution 2 :
if (Input.GetMouseButton(2) && !EventSystem.current.IsPointerOverGameObject())
{
// function
}
// perhaps =====
if (Input.GetMouseButton(2))
{
if(EventSystem.current.IsPointerOverGameObject())
return;
// function
}EventSystem.current.IsPointerOverGameObject(), yes EventSystem Methods provided , Used to determine whether the cursor is in UI Upper , I often do to solve the problem of ray penetration UI The problem of , Ah , I didn't think of this method before , Wrote the first solution , Now I feel a little ridiculous , But each has its uses , Let it be !
边栏推荐
- Unrealeengine4 - about uobject's giant pit that is automatically GC garbage collected
- Unity download and installation website
- Basic operations of Oracle data
- Records of some problems encountered during unity development (continuously updated)
- PWN入门(2)栈溢出基础
- Modbus protocol register
- GoLand No Tests Were Run : 不能使用 fmt.Printf() &lt;BUG&gt;
- 【VCS+Verdi联合仿真】~ 以计数器为例
- Preorder traversal of Li Kou 589:n fork tree
- Special folders in unity3d and their meanings
猜你喜欢

Create transfer generation point

中文版PyCharm改为英文版PyCharm

Unity3d packaging and publishing APK process

【VCS+Verdi联合仿真】~ 以计数器为例

虚析构和纯虚析构

Unit asynchronous jump progress

Some problems encountered in unity steamvr

Introduction to some representations, neighbors and degrees of Graphs

Yolov5 torch installation

力扣977. 有序数组的平方
随机推荐
[recruitment] UE4 Development Engineer
How can the international trading platform for frying US crude oil guarantee capital security?
很紧张,第一天做软件测试,需要做什么?
力扣209. 长度最小的子数组
Under what conditions does the Z-index attribute expire?
Unity dotween plug-in description
Pytorch的安装以及入门使用
Leetcode 180 Consecutive numbers (2022.06.29)
Unity/ue reads OPC UA and OPC Da data (UE4)
Special folders in unity3d and their meanings
Unity supports the platform # define instruction of script
amd锐龙CPU A320系列主板如何安装win7
Unity packaging failure solution
MySQL query gadget (I) replace a property value of the object in the JSON array in the JSON format string field
Yolov5 torch installation
【 VCS + Verdi joint simulation】 ~ Taking Counter as an Example
Unreal 4 learning notes - data storage using blueprints
Win10 vs2015 compiling curaengine
力扣59. 螺旋矩阵 II
Golan no tests were run: fmt Printf() &lt; BUG&gt;