Created
February 13, 2017 23:07
-
-
Save ahokinson/d98d0e56ec9b18b9383f62e17ad13fea to your computer and use it in GitHub Desktop.
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
using UnityEngine; | |
namespace Gubbins.Assertions | |
{ | |
public static class Assert | |
{ | |
public static void AssignIfNull<T>(ref T value) where T : Object | |
{ | |
if (value != null) return; | |
value = Object.FindObjectOfType<T>(); | |
Debug.LogAssertion("Assertion failed. " + (value != null ? value.name : "Nothing") + | |
" was found for missing " + typeof(T)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment