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

275
Views
El método OnTriggerStay2D() solo funciona cuando el jugador se está moviendo

Hice un campo de "radiación" simple a través de un disparador, pero solo funciona cuando el jugador se mueve. La función cuenta dos valores decimales. ¿Cual podría ser el problema?

 decimal radIntensity = 0.001m; decimal currentDose; private void OnTriggerStay2D(Collider2D area) { if (area.gameObject.tag == "Player") { currentDose += radIntensity; } print($"Current dose: {currentDose} R"); }
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

En el componenteRigidBody2D hay una opción para desactivar o activar el modo de suspensión.

Intente desactivarlo con la opción RigidbodySleepMode2D.NeverSleep .

over 4 years ago · Santiago Trujillo Report

0

También puede usar una bandera booleana y OnTriggerEnter2D y OnTriggerExit2D. Pero nunca dormir rígido es mucho mejor

 bool _flag; private void Update() { if (_flag) { currentDose += radIntensity; } print($"Current dose {currentDose} R"); } private void OnTriggerEnter2D(Collider2D area) { if (area.gameObject.tag == "Player") { _flag = true; } } private void OnTriggerExit2D(Collider2D other) { if (other.gameObject.tag == "Player") { _flag = !true; }
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!