Deadcows / MyBox

MyBox is a set of attributes, tools and extensions for Unity
http://deadcow.ru
MIT License
1.94k stars 244 forks source link

Change Billboard.cs to use Camera.main instead of FindObjectOfType<Camera>() #226

Closed adamgryu closed 1 year ago

adamgryu commented 1 year ago

If your scene has multiple cameras, then FindObjectOfType is not deterministic. Camera.main will reliably get the main camera.

I also added a RuntimeInitializeOnLoadMethod method for compatibility with EnterPlayMode settings.

Deadcows commented 1 year ago

Good point! And if some specific camera without MainCamera tag should be faced, it could be set as FacedObject 🤔 Thanks for the fix, I will mention it in the Changelog 🙏🏻