Created
October 14, 2021 13:23
-
-
Save RoeiRubach/b2a1df3b852fa1aac93b5f3442780027 to your computer and use it in GitHub Desktop.
[Generic Caching Method]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void ShouldCacheThing<TComponentType>(GameObject target, ref TComponentType field) where TComponentType : UnityEngine.Object //might need to be Component here | |
| { | |
| if (!field) | |
| field = target.GetComponent<TComponentType>(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment