Oooh I didn’t know CheckSphere was a thing! Thanks for sharing.
-
-
Bedankt, Twitter gebruikt dit om je tijdlijn te verbeteren. Ongedaan makenOngedaan maken
-
-
-
Great tip! Is that the same for 2d colliders and raycasts?
-
Yes. In-fact 2D physics has "List<T>" result support for ALL queries which Unity will automatically ensure has the correct capacity for the returned results. Reusing this list can result in no GC activity. The "All" and "NonAlloc" are effectively deprecated in 2D.
Einde van gesprek
Nieuw gesprek -
-
-
I did not know about those! And I have to optimize on those in my game soon. your advice is the best christmas gift! :)
Bedankt, Twitter gebruikt dit om je tijdlijn te verbeteren. Ongedaan makenOngedaan maken
-
-
-
Just out of curiosity, what would be the impact of using foreach (Collider c in Physics.OverlapSphere( transform.position, radius, layer)) { // do something with c } Do you get the same hit by treating Physics.OverlapSphere as an iterable? Or is foreach even worse?
-
I didn't tested but the function returns an array (we don't have a version with iterable) and the for iteration its cheaper than foreach so in theory, it's worse if you use foreach -.-
- Antwoorden weergeven
Nieuw gesprek -
Het laden lijkt wat langer te duren.
Twitter is mogelijk overbelast of ondervindt een tijdelijke onderbreking. Probeer het opnieuw of bekijk de Twitter-status voor meer informatie.
|