当前位置:网站首页>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 !
边栏推荐
- Unity packaging failure solution
- 力扣27. 移除元素
- Important knowledge points in unity3d
- Chapter 7 vertex processing and drawing commands of OpenGL super classic (7th Edition)
- On mask culling of unity
- 力扣704. 二分查找
- z-index属性在什么情况下会失效?
- GoLand No Tests Were Run : 不能使用 fmt.Printf() &lt;BUG&gt;
- 力扣292周赛题解
- 力扣2049:统计最高分的节点数目
猜你喜欢

HTC vive cosmos development - handle button event

What is multimodal interaction?

Detailed explanation of the process of "flyingbird" small game (camera adjustment and following part)

Harbor API 2.0 query

Unity packaging failure solution

Ugui uses its own function to realize reverse mask

Unity + hololens2 performance test

力扣704. 二分查找

Unit asynchronous jump progress
Sourcetree usage
随机推荐
MySQL query gadget (I) replace a property value of the object in the JSON array in the JSON format string field
Postman 做测试的 6 个常见问题
中文版PyCharm改为英文版PyCharm
Unity is associated with vs. there is a compiler problem when opening
Unity notes_ SQL Function
Chapter 8 primitive processing of OpenGL super classic (version 7)
Very nervous. What should I do on the first day of software testing?
东塔攻防世界—xss绕过安全狗
C # three ways to obtain web page content
Tcp/ip protocol details Volume I (Reading Guide)
力扣349. 两个数组的交集
Unity a* road finding force planning
Chinese pycharm changed to English pycharm
Important knowledge points in unity3d
Force buckle 27 Removing Elements
Autowired注解警告的解决办法
Unity Logitech steering wheel access
Solution to the 292 week match of Li Kou
0 foundation starts self-study unit notes control direction becomes larger
Redis cluster concept