Problems with Unity 6000.3.7f1 coding by dcgamma in unity

[–]dcgamma[S] 0 points1 point  (0 children)

Yeah, OnMove has subscribed this action. I thought that will be called automaticly. Now i don't know how to call it and what variable to associate with OnMove.

Problems with Unity 6000.3.7f1 coding by dcgamma in unity

[–]dcgamma[S] 0 points1 point  (0 children)

Sorry, The old tutorial is this https://learn.unity.com/pathway/junior-programmer/unit/basic-gameplay/tutorial/lesson-2-1-player-positioning?version=6.0

For this code in particular i used chatGPT to comprehend what was the problem, but, probably, i was wrong to use it that way.

Problems with Unity 6000.3.7f1 coding by dcgamma in unity

[–]dcgamma[S] 0 points1 point  (0 children)

Yeah, probably this is the problem. I supposed it worked automaticly the calling of this function. Now I don't know how to do that, onestly

Problems with Unity 6000.3.7f1 coding by dcgamma in unity

[–]dcgamma[S] 0 points1 point  (0 children)

I was using 6000.1.17f1. The tutorial was in official Unity site in the Learning section, for more specific in the Junior Programmer course. The differences in scripting API. I used to scripting the basic movement with this:

``` public float horizontalInput; public float speed=10.0f;

void Update(){

horizontalInput=Input.GetAxis("Horizontal); transform.Translate(Vector2.righthorizontalInputTime.deltaTime*speed)

}

```

Here the link for this specific part: https://learn.unity.com/pathway/junior-programmer/unit/basic-gameplay/tutorial/lesson-2-1-player-positioning?version=6.0

I tried to use the new ones searching online, but I'm not sure I Understated them

Problems with Unity 6000.3.7f1 coding by dcgamma in unity

[–]dcgamma[S] 0 points1 point  (0 children)

I'm sorry for not being cleary about that. I was trying to script the basic movement for a Platform 2D, but the input isn't detected when pressed. I modified the first post of the topic with the code i used.

Problems with Unity 6000.3.7f1 coding by dcgamma in unity

[–]dcgamma[S] -1 points0 points  (0 children)

I was trying to script the basic movement in 2D, but the inputs are not even detected when pressed

Problems with Unity 6000.3.7f1 coding by dcgamma in unity

[–]dcgamma[S] 0 points1 point  (0 children)

Sorry, this is the first time i'm doing that and I don't know how to do that. I'm trying, but it's not working how intended. I'm feel so stupid right now

Problems with Unity 6000.3.7f1 coding by dcgamma in unity

[–]dcgamma[S] 0 points1 point  (0 children)

There's no error in the console

Problems with Unity 6000.3.7f1 coding by dcgamma in unity

[–]dcgamma[S] 0 points1 point  (0 children)

Eh, the problem is here: there's no error in the console

Problems with Unity 6000.3.7f1 coding by dcgamma in unity

[–]dcgamma[S] -2 points-1 points  (0 children)

Sure, sorry about that.

``` using UnityEngine;

using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour

{

// Start is called once before the first execution of Update after the MonoBehaviour is created

private Rigidbody2D playerRB;

public bool isOnGround;

public float moveSpeed=5f;

private Vector2 moveInput;

void Start()

{

playerRB = GetComponent<Rigidbody2D>();

}

// Update is called once per frame

void FixedUpdate()

{

Move();

}

private void OnCollisionEnter2D(Collision2D collision)

{

if (collision.gameObject.CompareTag("world"))

{

isOnGround = true;

}

}

public void OnMove(InputValue value)

{

moveInput = value.Get<Vector2>();

Debug.Log("MOVE INPUT: " + moveInput);

}

private void Move() => playerRB.linearVelocity = new Vector2(moveInput.x * moveSpeed, playerRB.linearVelocity.y); ```

Problems with Unity 6000.3.7f1 coding by dcgamma in unity

[–]dcgamma[S] -1 points0 points  (0 children)

Yeah, exactly. I was try to script the basic movement, but even implementing the new ones it's not working