Hot answers tagged

2

When the player hits (enters the collider of) the wall, does the speed == 0 and does the player stop moving? If this is the case, then the problem is that you're setting the player speed to 0 if they're in the wall, but because their speed is now 0 there's no way for them to escape the wall. Solutions There's many ways you could go about solving this, here ...


1

Here you go my dude. public float speed; [SerializeField] private Vector3 nextPos; [SerializeField] private Vector3 destination; [SerializeField] private KeyCode lastKey; [SerializeField] private KeyCode preventKey = KeyCode.None; private void Update() { MoveTileBased(); } void MoveTileBased() { KeyCode[] keycodes = new KeyCode[] { KeyCode.W, ...


1

The method require a char not string public static string[] toArray(string str) { return str.Split(','); } Try use code editor recommended by Unity like Visual Studio. It show error right away and how to fix them.


1

Solution: Make CharacterMovement _characterMovement;public: (like this) public CharacterMovement _characterMovement; And then in the Inspector, drag the object that has CharacterMovement script attached to it.


1

Semantic actions defined in the Input Manager panel (like "Fire1") can no longer be used with the new input system. But you can still check the status of specific keyboard keys. The 1:1 equivalent of the old Input.GetKey(KeyCode.Space) would be Keyboard.current[Key.Space].isPressed. More examples for drop-in replacements for the old input system ...


1

Problem was, as @htmlcoderexe mentioned, the way % works in c#. But I'll accept solution from @DMGregory, which is the simpler one. @stephane-hockenhull also explained this thing in more technical detail of bitwise & (Under my question), but I'll still write my own answer as a bit simpler interpretation for people like me who get confused easily :) ...


Only top voted, non community-wiki answers of a minimum length are eligible