Hello,
I want to make C# script that will disable walking on “J” key but it doesn’t work.
private FirstPersonController FPS; ------ is underlined on red color
and
FPS = GetComponent<FirstPersonController>(); is underlined too.
using UnityEngine;
using System.Collections;
public class Chodzenie : MonoBehaviour
{
private FirstPersonController FPS;
void Start()
{
FPS = GetComponent<FirstPersonController>();
}
void Update()
{
if (Input.GetKeyDown(KeyCode.J))
{
FPS.enabled = false;
}
}
}
Thank you for help!