当前位置:网站首页>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 !
边栏推荐
猜你喜欢

Photon pun refresh hall room list

pycharm 数据库工具

Force buckle 27 Removing Elements

Pit of smoothstep node in shadergraph

Deeply understand the function calling process of C language

Unity is associated with vs. there is a compiler problem when opening

Basic operations of Oracle data

Unity packaging and publishing webgl error reason exception: failed building webgl player

Unity project hosting platform plasticscm (learn to use 1)

Introduction to some representations, neighbors and degrees of Graphs
随机推荐
Exploration of unity webgl
Unity3d lookat parameter description
Connect() and disconnect() of socket in C #
Records of some problems encountered during unity development (continuously updated)
z-index属性在什么情况下会失效?
力扣周赛293题解
Detailed explanation of the process of "flyingbird" small game (camera adjustment and following part)
Deep learning ----- different methods to realize inception-10
Nestjs中控制器和路由的配置使用
Force buckle 209 Minimum length subarray
很紧张,第一天做软件测试,需要做什么?
Untiy3d controls scene screenshots through external JSON files
炒美原油的国际交易平台如何能保障资金安全呢?
Nestjs配置静态资源,模板引擎以及Post示例
力扣209. 长度最小的子数组
Nestjs configures static resources, template engine, and post examples
【VCS+Verdi联合仿真】~ 以计数器为例
OpenGL draws model on QT platform to solve the problem of initializing VAO and VBO
Records of problems encountered in unity + hololens development
力扣977. 有序数组的平方