当前位置:网站首页>Vrtk reactivates the scene, jumps to the scene handle, and the UI interaction function is lost
Vrtk reactivates the scene, jumps to the scene handle, and the UI interaction function is lost
2022-07-23 05:35:00 【Glunn】
Project scenario :VR Jump to the scene in real time
Tips : Here is a brief introduction to the background of the project :
Use VRTK Plug ins and SteamVR
Unity2019.4.18
Problem description
Tips : The problems encountered in the project are described here :
In the use of VRTK Jump to the scene UI Interaction will disappear , The handle function will be lost .
Cause analysis :
Tips : Fill in the analysis of the problem here :

This is called EventSystem Things will automatically hide , therefore UI All interactive functions are lost
Solution :
Tips : Fill in the specific solution to the problem here :
Create a new empty object mount script EventHelper( notes : This script is not VRTK Script )
public GameObject EventSystem;
public VRTK_UIPointer PointerController;
public VRTK_UIPointer PointerController2;
private VRTK_VRInputModule[] inputModule;
private void Start()
{
StartCoroutine(LateStart(1));
}
private void Update()
{
if (inputModule != null)
{
if (inputModule.Length > 0)
{
inputModule[0].enabled = true;
if (inputModule[0].pointers.Count == 0)
inputModule[0].pointers.Add(PointerController);
if (inputModule.Length > 0)
{
inputModule[0].enabled = true;
if (inputModule[0].pointers.Count == 1)
inputModule[0].pointers.Add(PointerController2);
}
}
else
inputModule = EventSystem.GetComponents<VRTK_VRInputModule>();
}
}
IEnumerator LateStart(float waitTime)
{
yield return new WaitForSeconds(waitTime);
EventSystem.SetActive(true);
EventSystem.GetComponent<EventSystem>().enabled = false;
inputModule = EventSystem.GetComponents<VRTK_VRInputModule>();
}
Yes, it's that simple
Finally, in our scenario EventSystem Just connect a handle with ours 
边栏推荐
- Epoll use case details
- Tree and binary tree (C language)
- With only 5000 lines of code, AI rendered 100 million landscape paintings on Quanzhi v853
- 大一暑假实习day6_拼图游戏
- Leetcode-384. clutter array
- Vscode environment configuration management
- 超详解 - 如何理解C语言中while(scanf(“%d“, &num) != EOF)这一表达式?
- Today's homework blog
- 我的第一篇博客 | 记录编程之路的初心与目标
- 大一暑假实习day5_2
猜你喜欢
随机推荐
Code random notes_ Array_ 704 binary search
Leetcode-312. poking balloons
超详解 - 如何理解C语言中while(scanf(“%d“, &num) != EOF)这一表达式?
Today's homework blog
leetcode-646. 最长数对链
Some topics such as ctfhub web information disclosure WP CSDN creation punch in
Introduction to C language arrays, functions, operators, and keywords
Basic operation of linked list
Code random notes_ Linked list_ 19 exchange nodes in the linked list in pairs
"Dial" out the number on the number of digits - a variety of ideas to achieve reverse output of a four digit number
JDBC-API详解
Leetcode-188. the best time to buy and sell stocks IV
Detailed explanation of advanced data types in C language
leetcode-241.为运算表达式设计优先级
最大公约数和最小公倍数
Leetcode - the best time to buy and sell stocks, including handling charges
MySQL
Code random notes_ Linked list_ 206 reverse linked list
PR初始入门
大一暑假实习day6_拼图游戏








