[SOLVED] Show/Hide mouse on ESC for menu

Announcements, support questions, and discussion for the Dialogue System.
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Show/Hide mouse on ESC for menu

Post by supadupa64 »

Yeah I deleted the folders before I imported the source code. I got errors doing it the suggested way with like 1-2 fps.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show/Hide mouse on ESC for menu

Post by Tony Li »

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.
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Show/Hide mouse on ESC for menu

Post by supadupa64 »

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.
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Show/Hide mouse on ESC for menu

Post by supadupa64 »

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.
}
}
}
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: [SOLVED] Show/Hide mouse on ESC for menu

Post by Tony Li »

Thanks for posting your solution. I'll compare this script to the Dialogue System's bridge script and make updates if necessary.
Post Reply