HelperExtensions.cs 574 B

12345678910111213141516171819202122232425
  1. using UnityEditor;
  2. public static class HelperExtensions
  3. {
  4. public static bool Contains(this string[] array, string key)
  5. {
  6. for (int i = 0; i < array.Length; i++)
  7. {
  8. if (array[i] == key)
  9. return true;
  10. }
  11. return false;
  12. }
  13. public static MaterialProperty GetByName(this MaterialProperty[] properties, string name)
  14. {
  15. for (int i = 0; i < properties.Length; i++)
  16. {
  17. if (properties[i].name == name)
  18. return properties[i];
  19. }
  20. return null;
  21. }
  22. }