UnityEssentials
Small but useful tools and features for Unity
UnityEssentials
Unity Essentials
Assets
Essentials
Scripts
Extensions
ComponentExtensions.cs
Go to the documentation of this file.
1
namespace
UnityEngine
2
{
7
public
static
class
ComponentExtensions
8
{
14
public
static
T
GetComponentRequired<T>
(
this
Component
self
) where T : Component
15
{
16
T component =
self
.GetComponent<T>();
17
18
if
(component ==
null
) Debug.LogError(
"Could not find "
+ typeof(T) +
" on "
+
self
.name);
19
20
return
component;
21
}
22
}
23
}
24
UnityEngine
Definition:
CameraAnimation.cs:4
UnityEngine.ComponentExtensions
Extensions for Component
Definition:
ComponentExtensions.cs:8
UnityEngine.ComponentExtensions.GetComponentRequired< T >
static T GetComponentRequired< T >(this Component self)
Get a component. Log an error if it is not found.
Definition:
ComponentExtensions.cs:14
Generated by
1.9.1