Last active
March 16, 2018 19:24
-
-
Save wcoastsands/c2623642e6fedfd4e3ba to your computer and use it in GitHub Desktop.
My Unity Extensions
This file contains 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; | |
using System.Collections; | |
namespace com.wcoastsands | |
{ | |
public static class Extensions | |
{ | |
#region Object Extensions | |
public static T FindObjectOfType <T> (this Object unityObject) where T : Object | |
{ | |
return Object.FindObjectOfType(typeof(T)) as T; | |
} | |
public static T[] FindObjectsOfType <T> (this Object unityObject) where T : Object | |
{ | |
return Object.FindObjectsOfType(typeof(T)) as T[]; | |
} | |
#endregion // Object Extensions | |
#region String Extensions | |
public static string PascalCaseNoSpaces (this string s) | |
{ | |
string[] words = s.Split(' '); | |
string result = string.Empty; | |
foreach (string word in words) | |
{ | |
result += char.ToUpper(word[0]) + word.Substring(1); | |
} | |
return result; | |
} | |
#endregion // String Extensions | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment