|
Post by kirakuro on Apr 11, 2020 22:45:30 GMT
I am trying to access The Lock Input, Unlock Cursor on Start and Show Cursor on Start in a C# Script.
I am trying to Lock player movement, lock Melee Swinging, And show the Mouse on screen.
Here is what I have attempted so far and failed:
public vMeleeCombatInput vInputs; public vThirdPersonInput vThirdPersonInputs; public void LockInputOnPlayerAndShowCursor() { vInputs.horizontalInput.useInput = true; vInputs.verticallInput.useInput = true; vInputs.lockMeleeInput = true; vInputs.SetLockAllInput(true); vInputs.SetLockMeleeInput(true); vInputs.showCursorOnStart = true; vInputs.unlockCursorOnStart = true; vThirdPersonInputs.showCursorOnStart = true; vThirdPersoninputs.unlockCursorOnStart = true; } void Start() { LockInputOnPlayerAndShowCursor(); }
So far All i have got to work is the player cannot move using horizontal/vertical inputs, however there is no mouse on screen and the player can still click and swing his weapon/block, and I am trying to access UI so I don't want that.
|
|
|
Post by Invector on Apr 13, 2020 17:21:37 GMT
You can call it directly from the tpInput, no need to call the vInput
using Invector.vCharacterController; using UnityEngine;
public class AccessInputExample : MonoBehaviour { public vThirdPersonInput tpInput; public bool lockInput;
private void Start() { tpInput.GetComponent<vThirdPersonInput>();
if (!tpInput) return; tpInput.SetLockAllInput(lockInput); // call other methods you may need } }
|
|