Hello i hope some unity professional is reading this but idk why unity is being a complete idiot
float Horizontal;
float vertical;
Rigidbody2D rb;
public bool facingRight=true;
Animator anim;
public Vector3 Ya;
public bool knockback;
public float timer;
// Start is called before the first frame update
void Start()
{
rb = gameObject.GetComponent<Rigidbody2D>();
anim = gameObject.GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
Horizontal = Input.GetAxisRaw("Horizontal");
vertical = Input.GetAxisRaw("Vertical");
if (Input.GetKeyDown(KeyCode.U))
{
Debug.Log(" dgsj ghghegiodhsgheosgdhsghes");
rb.velocity = new Vector2(32, 32);
}
if (Horizontal > 0 && facingRight == false)
{
flip();
}
else if (Horizontal < 0 && facingRight == true)
{
flip();
}
rb.velocity = new Vector2(Horizontal, 68943);
}
private void FixedUpdate()
{
rb.velocity = new Vector2(Horizontal, vertical);
if(Horizontal==1 || vertical==1 || Horizontal == -1 || vertical == -1)
{
anim.SetBool("Walken", true);
}
else
{
anim.SetBool("Walken", false);
}
}
Basically i got this super simple script and rb.velocity = new Vector2(Horizontal, 68943); doesnt work, i even debugged it
if (Input.GetKeyDown(KeyCode.U))
{
Debug.Log(" dgsj ghghegiodhsgheosgdhsghes");
rb.velocity = new Vector2(32, 32);
}
It doesnt work, i tried using floats nothing does exepct rb.velocity = new Vector2(Horizontal, vertical);
Idk why idk how but i just wanna fix this so i can continue working on my game, nothing worked so far, from using floats, to putting it in fixed update etc. I also tried using diffrent gameobjects and diffrenc scripts etc but nothing worked and i hate this dumb shitty gamengine