also caching GetComponent<>, I see so much code around the net using that on Update() :(
-
-
-
Yes, totally. :/
Ende der Unterhaltung
Neue Unterhaltung -
-
-
oh wow, I thought Camera.main would be a static reference or something, have some code to update right now!
-
Hahaha, refactor away!
Ende der Unterhaltung
Neue Unterhaltung -
-
-
Here is one video that explain that and more about optimization.https://youtu.be/_wxitgdx-UI
Danke! Twitter wird dies nutzen, um deine Timeline zu verbessern. Rückgängig machenRückgängig machen
-
-
-
Thanks!
-
you're welcome, hope is useful!
Ende der Unterhaltung
Neue Unterhaltung -
-
-
Thanks for sharing! What's the significance of impact from doing this instead? Like potentially a few more FPS?
-
yes, this will improve the use of CPU as you won't need to do a search every time. Potentially improving your FPS.
Ende der Unterhaltung
Neue Unterhaltung -
-
-
I haven't seen any explanation as to why it is done like this. It seems like that behavior could be optimized by default and probably should be considering a dev could be using components from the store that might change the active camera at any point while playing.
-
That's a very good question, I don't have the answer as for why it works that way. But one thing that helps is that modern IDE's such as
@VisualStudio and@JetBrainsRider can help devs find those cases. - Antworten anzeigen
Neue Unterhaltung -
Das Laden scheint etwas zu dauern.
Twitter ist möglicherweise überlastet oder hat einen vorübergehenden Schluckauf. Probiere es erneut oder besuche Twitter Status für weitere Informationen.