#can you dm me i can show you anything
1 messages · Page 1 of 1 (latest)
This is a screenshot of your PlayerInput inspector, and it's in debug mode for some reason
Change it out of debug mode and show the event subscriptions you set up
actually i cant move my camera and player but everything except these is working perfectly like sfx, timer and all
Open the action map
Expand it
Where it says New Action Map
Under events
You haven't assigned any listeners here
So it makes sense your code is not responding to input
Show your code?
Whichever one isn't doing the thing you want it to do
i think inputmanager might be the one cuz the input is the only problem
You would know better than me
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
!code for sharing code please:
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
!code c#
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
!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();
}
}
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/, https://scriptbin.xyz/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
A tool for sharing your source code with the world!
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?
wait lemme see
PlayerMovement.cs
https://paste.mod.gg/rlywkwdgakjt/0
A tool for sharing your source code with the world!
Ok for the jumping part here you're trying to read jum[pTriggered in FixedUpdate which is not going to work
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
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?
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
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
umm ok..
thanks for the help btw