Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyExtensions.HasComponent<T> arbitrarily has a stricter type constraint than GameObject.GetComponent<T> #53

Closed
tonygiang opened this issue Jan 24, 2020 · 1 comment

Comments

@tonygiang
Copy link
Contributor

The built-in method GameObject.GetComponent<T> has no type constraint to serve a specific use case: To get all components on a GameObject that are subtypes of an interface passed as T. The MyExtensions.HasComponent<T> method in this package should remove the type constraint so that it can check every type that GameObject.GetComponent<T> can get, especially since the current implementation of MyExtensions.HasComponent<T> is just
return gameObject.GetComponent<T>() != null;

@Deadcows
Copy link
Owner

Thanks for bringing this up! Fixed it in latest commit. I should review my extensions probably :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants