[SOLVED] Show/Hide mouse on ESC for menu
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Re: Show/Hide mouse on ESC for menu
Yeah I deleted the folders before I imported the source code. I got errors doing it the suggested way with like 1-2 fps.
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Re: Show/Hide mouse on ESC for menu
If something is spamming the Console with debug lines, it'll kill your fps. If you want to pursue it, please post a sample of the debug lines here. Otherwise we can pick it up again when TPC 1.3 comes out.
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Re: Show/Hide mouse on ESC for menu
It's not a big deal right now since it's basically figured out. It's not happening anymore since I reverted back to the original files atm.
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Re: Show/Hide mouse on ESC for menu
I think it's all figured out now. I installed all current versions of DS and TPC and the new hide/show cursor for TPC update still doesn't work. But, I did use this script that someone else made that solved the hide/show cursor situation! It Works perfect! I just unchecked the "Disable with Escape" box from TPC and used this script below and placed it on my player. Anyone else having this same problem can use this to fix it! =)
using UnityEngine;
using System.Collections;
using Opsive.ThirdPersonController;
using UnityEngine.UI;
public class CursorLock : MonoBehaviour
{
bool cursor = true;
void Update ()
{
//Cursor key toggle
if (Input.GetKeyDown(KeyCode.Escape))
{
if(cursor == true)
{
Cursor.lockState = CursorLockMode.None; //unlock cursor
Cursor.visible = true; //make mouse visible
EventHandler.ExecuteEvent(gameObject, "OnAllowGameplayInput", false); //disable TPC input
}
if (cursor == false)
{
Cursor.lockState = CursorLockMode.Locked; //lock cursor
Cursor.visible = false; //disable visible mouse
EventHandler.ExecuteEvent(gameObject, "OnAllowGameplayInput", true); // allow TPC input
}
cursor = !cursor; //switch cursor boolean.
}
}
}
using UnityEngine;
using System.Collections;
using Opsive.ThirdPersonController;
using UnityEngine.UI;
public class CursorLock : MonoBehaviour
{
bool cursor = true;
void Update ()
{
//Cursor key toggle
if (Input.GetKeyDown(KeyCode.Escape))
{
if(cursor == true)
{
Cursor.lockState = CursorLockMode.None; //unlock cursor
Cursor.visible = true; //make mouse visible
EventHandler.ExecuteEvent(gameObject, "OnAllowGameplayInput", false); //disable TPC input
}
if (cursor == false)
{
Cursor.lockState = CursorLockMode.Locked; //lock cursor
Cursor.visible = false; //disable visible mouse
EventHandler.ExecuteEvent(gameObject, "OnAllowGameplayInput", true); // allow TPC input
}
cursor = !cursor; //switch cursor boolean.
}
}
}
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Re: [SOLVED] Show/Hide mouse on ESC for menu
Thanks for posting your solution. I'll compare this script to the Dialogue System's bridge script and make updates if necessary.