I have been following the official tutorial video to get the QuickStart conversation to begin when approaching a character and pressing "E."
I have generated the C# class script from the Input Action asset, called "PlayerControls"
My registration script, "DSRegNewInput" contains the following code:
Code: Select all
using UnityEngine;
using UnityEngine.InputSystem;
using PixelCrushers;
//Makes Unity's New Input System actions available to Dialogue System. PlayerInput component is not required
//Copy syntax to add new actions, names must be EXACT matches (incl. capitalization)
//Name in quotes is what will be used by Dialogue System
//Also add to OnDisable to allow them to be turned on and off at will
//xxx.playerMovement.Back | Input Action C# class script name
//playerControls.xxx.Back | Action map name
//playerControls.playerMovement.XXX | Action name
public class DSNewInput : MonoBehaviour
{
protected static bool isRegistered = false;
private bool didIRegister = false;
private PlayerControls controls;
void Awake()
{
controls = new MyControls();
}
void OnEnable()
{
if (!isRegistered)
{
isRegistered = true;
didIRegister = true;
controls.Enable();
InputDeviceManager.RegisterInputAction("Back", PlayerControls.playerMovement.Back);
InputDeviceManager.RegisterInputAction("Interact", PlayerControls.playerMovement.Interact);
InputDeviceManager.RegisterInputAction("Submit", PlayerControls.UI.Submit);
InputDeviceManager.RegisterInputAction("Cancel", PlayerControls.UI.Cancel);
InputDeviceManager.RegisterInputAction("Navigate", PlayerControls.UI.Navigate);
InputDeviceManager.RegisterInputAction("OpenInventory", PlayerControls.UI.OpenInventory);
}
}
void OnDisable()
{
if (didIRegister)
{
isRegistered = false;
didIRegister = false;
controls.Disable();
InputDeviceManager.UnregisterInputAction("Back");
InputDeviceManager.UnregisterInputAction("Interact");
InputDeviceManager.UnregisterInputAction("Submit");
InputDeviceManager.UnregisterInputAction("Cancel");
InputDeviceManager.UnregisterInputAction("Navigate");
InputDeviceManager.UnregisterInputAction("OpenInventory");
}
}
}
When trying to launch the game I get 7 compile errors:
Code: Select all
Assets\Scripts\DSRegNewInput.cs(32,64): error CS0120: An object reference is required for the non-static field, method, or property 'PlayerControls.playerMovement'
plus
Code: Select all
Assets\Scripts\DSRegNewInput.cs(22,24): error CS0246: The type or namespace name 'MyControls' could not be found (are you missing a using directive or an assembly reference?)
Thanks in advance for any advice
