- Home /
Bug or problem: UI Elements duplicated and follow in front of player when run, working with Oculus VR
Hi everyone,
I'm working with Oculus Integration in my project. I created two months ago the Main Menu of my project and everything was fine until one day when I run my project, the UI elements were duplicated and this UI double is following player movement. The good one stays still, like before.
My code:
public class menuIniciScript : MonoBehaviour { // Start is called before the first frame update
private GameObject StartMenu;
private GameObject RegisterMenu;
private GameObject LogInMenu;
private GameObject GameModeMenu;
private GameObject keyboard;
private GameObject currentField;
private UserController userControl;
void Start()
{
this.StartMenu = GameObject.Find("Start");
this.RegisterMenu = GameObject.Find("SignInMenu");
this.LogInMenu = GameObject.Find("LogInMenu");
this.GameModeMenu = GameObject.Find("GameModeMenu");
this.keyboard = GameObject.Find("Keyboard");
this.userControl = GameObject.Find("UserControl").GetComponent<UserController>();
this.GameModeMenu.SetActive(false);
LogInMenu.SetActive(false);
RegisterMenu.SetActive(false);
this.keyboard.SetActive(false);
}
public void showSignInMenu(){
this.StartMenu.SetActive(false);
this.RegisterMenu.SetActive(true);
}
public void showLogInMenu(){
this.StartMenu.SetActive(false);
this.LogInMenu.SetActive(true);
}
public void showGameModeMenu()
{
ocultarKeyBoard();
LogInMenu.SetActive(false);
RegisterMenu.SetActive(false);
this.GameModeMenu.SetActive(true);
}
public void chefMode()
{
if (!userControl.isTutorialChefCompleted())
{
DontDestroyOnLoad(GameObject.Find("UserControl"));
SceneManager.LoadScene("Tutorial");
}
else
{
DontDestroyOnLoad(GameObject.Find("UserControl"));
SceneManager.LoadScene("ChefScene");
}
}
public void waiterMode()
{
if (!userControl.isTutorialWaiterCompleted())
{
DontDestroyOnLoad(GameObject.Find("UserControl"));
SceneManager.LoadScene("WaiterTutorial");
}
else
{
DontDestroyOnLoad(GameObject.Find("UserControl"));
SceneManager.LoadScene("WaiterScene");
}
}
public void mostrarKeyBoard(){
this.keyboard.SetActive(true);
currentField = GameObject.Find(EventSystem.current.currentSelectedGameObject.name);
}
public void onKeyPressed(){
if (currentField){
currentField.GetComponent<TMPro.TMP_InputField>().text = currentField.GetComponent<TMPro.TMP_InputField>().text + EventSystem.current.currentSelectedGameObject.name;
}
}
public void removePressed(){
if (currentField){
currentField.GetComponent<TMPro.TMP_InputField>().text = currentField.GetComponent<TMPro.TMP_InputField>().text.Remove(currentField.GetComponent<TMPro.TMP_InputField>().text.Length -1);
}
}
public void ocultarKeyBoard(){
this.keyboard.SetActive(false);
}
public void backFromSignIn(){
this.currentField = null;
GameObject.Find("UserNameFieldRegister").GetComponent<TMPro.TMP_InputField>().text = "";
GameObject.Find("PasswordFieldRegister").GetComponent<TMPro.TMP_InputField>().text = "";
this.keyboard.SetActive(false);
this.RegisterMenu.SetActive(false);
this.StartMenu.SetActive(true);
}
public void backFromLogIn(){
this.currentField = null;
GameObject.Find("UserNameFieldLogIn").GetComponent<TMPro.TMP_InputField>().text = "";
GameObject.Find("PasswordFieldLogIn").GetComponent<TMPro.TMP_InputField>().text = "";
this.keyboard.SetActive(false);
this.LogInMenu.SetActive(false);
this.StartMenu.SetActive(true);
}
public void saveOnExit(){
StartCoroutine(putRequest());
}
public void authentication(){![alt text][1]
StartCoroutine(searchUser());
}![alt text][2]
If anyone knows the bug o the possible problem, please help me.
[1]: /storage/temp/176691-unitymainmenu.jpg
[2]: /storage/temp/176690-comtfgalexprovatfg-20210227-1328291.jpg
comtfgalexprovatfg-20210227-1328291.jpg
(139.7 kB)
unitymainmenu.jpg
(264.5 kB)
Comment