当前位置:网站首页>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 !
边栏推荐
- Modbus protocol register
- Unity lens making
- Tensorflow2 of ubantu18.04 X installation
- ParticleSystem in the official Manual of unity_ Collision module
- 2021-03-16
- Chinese pycharm changed to English pycharm
- Unity + hololens publishing settings
- Unreal 4 learning notes - Animated Montage
- Nestjs introduction and environment construction
- Nestjs configures static resources, template engine, and post examples
猜你喜欢

PWN入门(2)栈溢出基础

Some books you should not miss when you are new to the workplace

MinGW-w64下载文件失败the file has been downloaded incorrectly!

力扣704. 二分查找

Yolov5 torch installation

The file has been downloaded incorrectly!

Unity project hosting platform plasticscm (learn to use 2)

LXC 和 LXD 容器总结

Create transfer generation point

Some problems encountered in unity steamvr
随机推荐
Unity2019.3.8f1 development environment configuration of hololens2
0 foundation starts self-study unit notes control direction becomes larger
Harbor API 2.0 query
力扣589:N 叉树的前序遍历
Unity Logitech steering wheel access
PWN入门(2)栈溢出基础
Malignant bug: 1252 of unit MySQL export
003-JS-DOM-Attr-innerText
C # Foundation
SCM learning notes: interrupt learning
pycharm 数据库工具
Photon pun refresh hall room list
Pit of smoothstep node in shadergraph
Special folders in unity3d and their meanings
力扣209. 长度最小的子数组
Chapter 12 pipeline monitoring of OpenGL super classic (version 7)
Unity realizes rotation and Revolution
Solution to 293 problems in the week of Li Kou
Unity multiple UI page turning left and right
z-index属性在什么情况下会失效?