Skip to content

Instantly share code, notes, and snippets.

@wcoastsands
Last active March 16, 2018 19:24
Show Gist options
  • Save wcoastsands/c2623642e6fedfd4e3ba to your computer and use it in GitHub Desktop.
Save wcoastsands/c2623642e6fedfd4e3ba to your computer and use it in GitHub Desktop.
My Unity Extensions
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