#can you dm me i can show you anything

1 messages · Page 1 of 1 (latest)

vestal acorn
#

here is the screenshot of the input system config

deep wren
#

Change it out of debug mode and show the event subscriptions you set up

vestal acorn
#

ok wait

#

is that what you asking for?

vestal acorn
deep wren
#

Expand it

#

Where it says New Action Map

#

Under events

vestal acorn
deep wren
#

You haven't assigned any listeners here

#

So it makes sense your code is not responding to input

#

Show your code?

vestal acorn
#

which one?

#

which one of them?

deep wren
#

Whichever one isn't doing the thing you want it to do

vestal acorn
deep wren
#

You would know better than me

vestal acorn
#

using UnityEngine;
using UnityEngine.InputSystem;

[DefaultExecutionOrder(-100)]
public class InputManager : MonoBehaviour
{
public static InputManager Instance { get; private set; }

public Vector2 MoveInput { get; private set; }
public Vector2 LookInput { get; private set; }
public bool JumpTriggered { get; private set; }
public bool IsSprinting { get; private set; } 

private InputAction _moveAction;
private InputAction _lookAction;
private InputAction _jumpAction;
private InputAction _sprintAction;

private void Awake()
{
    if (Instance != null && Instance != this)
    {
        Destroy(gameObject);
        return;
    }
    Instance = this;
    DontDestroyOnLoad(gameObject);

    SetupInputActions();
}

private void SetupInputActions()
{
    _moveAction = new InputAction("Move", InputActionType.Value, "<Keyboard>/wasd");
    _lookAction = new InputAction("Look", InputActionType.Value, "<Mouse>/delta");
    _jumpAction = new InputAction("Jump", InputActionType.Button, "<Keyboard>/space");
    _sprintAction = new InputAction("Sprint", InputActionType.Button, "<Keyboard>/leftShift");

    _moveAction.Enable();
    _lookAction.Enable();
    _jumpAction.Enable();
    _sprintAction.Enable();
}

private void Update()
{
    MoveInput = _moveAction.ReadValue<Vector2>();
    LookInput = _lookAction.ReadValue<Vector2>();
    JumpTriggered = _jumpAction.triggered;
    IsSprinting = _sprintAction.IsPressed(); 
}

private void OnDestroy()
{
    _moveAction?.Disable();
    _lookAction?.Disable();
    _jumpAction?.Disable();
    _sprintAction?.Disable();
}

}
this is InputManager code

deep wren
#

!code for sharing code please:

wide etherBOT
vestal acorn
#

!code c#

wide etherBOT
vestal acorn
#

!code c#
using UnityEngine;
using UnityEngine.InputSystem;

[DefaultExecutionOrder(-100)]
public class InputManager : MonoBehaviour
{
public static InputManager Instance { get; private set; }

public Vector2 MoveInput { get; private set; }
public Vector2 LookInput { get; private set; }
public bool JumpTriggered { get; private set; }
public bool IsSprinting { get; private set; } 

private InputAction _moveAction;
private InputAction _lookAction;
private InputAction _jumpAction;
private InputAction _sprintAction;

private void Awake()
{
    if (Instance != null && Instance != this)
    {
        Destroy(gameObject);
        return;
    }
    Instance = this;
    DontDestroyOnLoad(gameObject);

    SetupInputActions();
}

private void SetupInputActions()
{
    _moveAction = new InputAction("Move", InputActionType.Value, "<Keyboard>/wasd");
    _lookAction = new InputAction("Look", InputActionType.Value, "<Mouse>/delta");
    _jumpAction = new InputAction("Jump", InputActionType.Button, "<Keyboard>/space");
    _sprintAction = new InputAction("Sprint", InputActionType.Button, "<Keyboard>/leftShift");

    _moveAction.Enable();
    _lookAction.Enable();
    _jumpAction.Enable();
    _sprintAction.Enable();
}

private void Update()
{
    MoveInput = _moveAction.ReadValue<Vector2>();
    LookInput = _lookAction.ReadValue<Vector2>();
    JumpTriggered = _jumpAction.triggered;
    IsSprinting = _sprintAction.IsPressed(); 
}

private void OnDestroy()
{
    _moveAction?.Disable();
    _lookAction?.Disable();
    _jumpAction?.Disable();
    _sprintAction?.Disable();
}

}

wide etherBOT
vestal acorn
deep wren
#

ok so this code isn't actually using the PlayerInput component at all

#

nor your INput Actions Asset, if you have one

#

Show the code that handles rotating the camera and jumping?

vestal acorn
#

wait lemme see

vestal acorn
deep wren
#

FixedUpdate doesn't run every frame

#

.triggered on the jump action only happens on the exact frame you press the key

#

so you are going to miss inputs

#

And rotating/looking doesn't happen in this script at all

vestal acorn
#

ok look i am so new into game dev and i dont know anything about coding like most of the coding part of my project is done by AI so what should i do now?

deep wren
#

also it's possible you have issues with your grounded check as well, but you'll have to debug to find out

#

ok look i am so new into game dev and i dont know anything about coding like most of the coding part of my project is done by AI so what should i do now?
Well you've dug yourself into a hole now

#

you have no idea how any of your code works

#

so you're not going to be able to fix it

#

except by either trying to feed more of it into AI

#

or by actually learning

#

If you are interested in actually learning, you should focus on that

#

start with !learn

wide etherBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

vestal acorn
#

thanks for the help btw