Hi Tony,
I am sure you've been over this error before, but I tried searching for it, and couldn't find anything.
I am trying to add the RegisterMyControls.cs script you advised in the youtube video about input control, and I keep getting two errors:
"Assets/Scripts/RegisterMyControls.cs(23,153): error CS1061: 'PlayerInput' does not contain a definition for 'Gameplay' and no accessible extension method 'Gameplay' accepting a first argument of type 'PlayerInput' could be found (are you missing a using directive or an assembly reference?)"
"Assets/Scripts/RegisterMyControls.cs(23,77): error CS1061: 'PlayerInput' does not contain a definition for 'Gameplay' and no accessible extension method 'Gameplay' accepting a first argument of type 'PlayerInput' could be found (are you missing a using directive or an assembly reference?)"
I am pretty new to coding, but I got the understood the basic issue - My PlayerInput script does not mention or define a class to 'Gameplay'.
Problem is, I don't know how I would go about doing that. Any guidiance you could give would be very much appreciated. I can post code if needed, but it's the .cs that Unity created and I haven't touched it.
does not contain a definition for 'Gameplay'
Re: does not contain a definition for 'Gameplay'
Hi,
Would you please post the C# script that the Input System has generated? I'll reply back with the RegisterMyControls script that you'll need to use.
Would you please post the C# script that the Input System has generated? I'll reply back with the RegisterMyControls script that you'll need to use.
Re: does not contain a definition for 'Gameplay'
It won't let me post the code in the message since it's too long, so I've uploading the file to my dropbox: https://www.dropbox.com/s/m2kwv4qsfx2dr ... ut.cs?dl=0
Re: does not contain a definition for 'Gameplay'
Thanks. Try adding this script to your Dialogue Manager:
RegisterMyControls.cs
This will give the Dialogue System's Input Device Manager access to the inputs named "Submit" and "Cancel". If you need to give it access to more inputs that you've defined in your Input Actions asset, follow the same format for the InputDeviceManager.RegisterInputAction and InputDeviceManger.UnregisterInputAction lines.
RegisterMyControls.cs
Code: Select all
using UnityEngine;
using PixelCrushers;
public class RegisterMyControls : MonoBehaviour
{
protected static bool isRegistered = false;
private bool didIRegister = false;
private PlayerInput controls;
void Awake()
{
controls = new PlayerInput();
}
void OnEnable()
{
if (!isRegistered)
{
isRegistered = true;
didIRegister = true;
controls.Enable();
InputDeviceManager.RegisterInputAction("Submit", controls.UI.Submit);
InputDeviceManager.RegisterInputAction("Cancel", controls.UI.Cancel);
}
}
void OnDisable()
{
if (didIRegister)
{
isRegistered = false;
didIRegister = false;
controls.Disable();
InputDeviceManager.UnregisterInputAction("Submit");
InputDeviceManager.UnregisterInputAction("Cancel");
}
}
}
Re: does not contain a definition for 'Gameplay'
Thank you so much!
Re: does not contain a definition for 'Gameplay'
Glad to help!