Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
Ejecutar el bucle de animación es raro (ver video) (C#)

Cada vez que mi personaje se ejecuta, tiene este bucle extraño, le pregunté a otras personas y revisé los tutoriales. No pude encontrarlo. Ver vídeo para más información.

Video:

Video

Código:

 public GameObject thePlayer; public bool isRunning; public float horizontalMove; public float verticalMove; void Update () { if (Input.GetButton("Horizontal") || Input.GetButton("Vertical")) { thePlayer.GetComponent<Animation>().Play("Run"); horizontalMove = Input.GetAxis("Horizontal") * Time.deltaTime * 150; verticalMove = Input.GetAxis("Vertical") * Time.deltaTime * 8; isRunning = true; transform.Rotate(0, horizontalMove, 0); transform.Translate(0, 0, verticalMove); } else { thePlayer.GetComponent<Animation>().Play("Idle"); isRunning = false; } }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

La razón de esto podría ser que obtenga el componente en cada cuadro en lugar de solo obtenerlo una vez. Eso podría causar problemas. Intenta hacer esto:

 void Start() { anim = thePlayer.GetComponent<Animator>(); }

y luego reprodúzcalo en la función Actualizar de esta manera:

 anim.Play("Run");

y luego en su declaración else, haga lo mismo con Idle solo para asegurarse:

 anim.Play("Idle");
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!