Hi Chris,
Thanks so much for all the help.
I am creating a first person game in which I'd like to toggle the cursor for the player if they enter a menu from full-movement model.
1. I wrote the following script and attached to an adventure creator actionlist called by clicking (using) a hotspot. When the spot is clicked on, I want to open a menu, and then call a script to check if the cursor is toggled on (so the mouse can control the cursor to go all over the screen), and toggle it to do so if it isn't. The following is what I have so far:
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetAxis ("ToggleCursor") == -1)
AC.KickStarter.playerInput.SimulateInput (AC.SimulateInputType.Axis, "ToggleCursor", 0);
}
}
**
Questions:
1. I'm guessing at the parameters (-1 and 0). Is there a reference for what the parameters should be for ToggleCursor
2. I am attaching this component to the actionlist that gets called by the hotspot. Will this call the script?
3. I want to do this to the pause menu too. How do I call it at the same time as the pause menu (right now I'm planning to create an axis with the same keystroke - in this case esc).
Thanks for any help you have.
tim
Comments
If the Menu you are opening has Pause game when enabled? checked, then the mouse cursor should automatically unlock when it's turned on.
Otherwise, you can use the Player: Constrain Action to lock free-aiming. This will override the effects of ToggleCursor, so will always ensure the cursor is unlocked. You can place this in an asset file and set it to your Menu's ActionList on turn on field. And the reverse for the turn off field.
Thanks so much!