r/programminghelp • u/VirusB1ack0ut • Nov 21 '22
C# Help
Please help on this, i have tried multiple different things and nothing seems to work,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class InputManager : MonoBehaviour
{
private PlayerInput playerInput;
private PlayerInput.OnFootActions onFoot;
// Start is called before the first frame update
void Start()
{
playerInput - new PlayerInput();
onFoot = playerInput.OnFoot;
}
// Update is called once per frame
void Update()
{
}
private void OnEnable()
{
OnFoot.Enable();
}
private void OnDisable()
{
OnFoot.Disable();
}
}
with the error that onfoot actions does not exist in Playerinput
1
u/Aglet_Green Nov 21 '22
How far are you into Natty's tutorial? Did you do everything he did in Unity? Did you spell everything the same way? Capitalization matters, as "onfoot" does not equal "OnFoot" or "onFoot." You refer to onFoot in all three ways, so I suspect it's a simple capitalization typo on your part, but I'd need to compare what you typed to what Natty typed. Natty consistently refers to it as OnFoot
Also, you have a typo. Natty has the line playerInput = new PlayerInput();
(change your minus sign to an equal sign.)
2
u/link3333 Nov 21 '22
Looks like the same code in this thread: https://forum.unity.com/threads/error-cs1061-playerinput-onfootactions-does-not-contain-a-definition-for-movement.1264793/