Skip to content

Instantly share code, notes, and snippets.

@inutamago-dogegg
Created July 17, 2023 10:05
Show Gist options
  • Save inutamago-dogegg/b85b993eb3fae79976fff4b7e710dc55 to your computer and use it in GitHub Desktop.
Save inutamago-dogegg/b85b993eb3fae79976fff4b7e710dc55 to your computer and use it in GitHub Desktop.
using System.Linq;
using UnityEngine;
public static T[] FindObjectsByInterface<T>() where T : class {
return Object.FindObjectsByType<Component>(FindObjectsSortMode.None).OfType<T>().ToArray();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment