Valheim-Modding / Jotunn

Jötunn, the Valheim Library.
https://valheim-modding.github.io/Jotunn/
MIT License
120 stars 40 forks source link

Extensions for GameObject, Transform, and String to provide convience methods #416

Closed searica closed 10 months ago

searica commented 10 months ago

I had originally intended to break these into a few smaller PRs but since the goal is a release this weekend I merged them into a single PR. In general each commit corresponds to a set of related extension methods for each class and explains the rationale behind adding those methods, so that it's hopefully easier to accept/reject whatever subset of extensions are judged to be appropriate for Jotunn.

searica commented 10 months ago

I've pushed a new set of changes that hopefully incorporate the feedback you gave. I'm not sure that the way I rewrote HasAllComponents to avoid null checks is the best way though.

Edit: I did some more reading on MonoBehavior and how Unity handles implicitly casting them to a bool, so I removed the counter in HasAllComponents to optimize it a bit more.