JUtils
A unity utilities library
JUtils.ComponentExtensions Class Reference

Useful extensions for working with components More...

Static Public Member Functions

static Ray ForwardRay (this Component self)
 Returns a Ray struct with the position and forward of this component's transform More...
 
static bool HasLayer (this Component comp, int layer)
 Compare if a gameObject has a layer More...
 
static bool HasComponent< T > (this Component self)
 Check if a component exists on the components game-object More...
 
static bool HasComponent (this Component self, Type type)
 Check if a component exists using the Type specification More...
 
static bool TryGetComponentInChildren< T > (this Component self, out T component)
 Try get a component in the children More...
 
static T GetComponentInDirectChildren< T > (this Component self)
 Get a component in the direct children of the component's transform. Won't look into children of children More...
 
static bool TryGetComponentInDirectChildren< T > (this Component self, out T component)
 Try get a component in in the direct children of this component More...
 
static T GetComponentInParentsDirect< T > (this Component self)
 Get a component in the direct parents of this component (Without this my own component) More...
 
static bool CopyTo< T > (this T self, T target)
 Copy one component to another Source: https://answers.unity.com/questions/530178/how-to-get-a-component-from-an-object-and-add-it-t.html More...
 

Detailed Description

Useful extensions for working with components

Member Function Documentation

◆ CopyTo< T >()

static bool JUtils.ComponentExtensions.CopyTo< T > ( this T  self,
target 
)
inlinestatic

Copy one component to another Source: https://answers.unity.com/questions/530178/how-to-get-a-component-from-an-object-and-add-it-t.html

Type Constraints
T :Component 

◆ ForwardRay()

static Ray JUtils.ComponentExtensions.ForwardRay ( this Component  self)
inlinestatic

Returns a Ray struct with the position and forward of this component's transform

◆ GetComponentInDirectChildren< T >()

static T JUtils.ComponentExtensions.GetComponentInDirectChildren< T > ( this Component  self)
inlinestatic

Get a component in the direct children of the component's transform. Won't look into children of children

Type Constraints
T :Component 

◆ GetComponentInParentsDirect< T >()

static T JUtils.ComponentExtensions.GetComponentInParentsDirect< T > ( this Component  self)
inlinestatic

Get a component in the direct parents of this component (Without this my own component)

Type Constraints
T :Component 

◆ HasComponent()

static bool JUtils.ComponentExtensions.HasComponent ( this Component  self,
Type  type 
)
inlinestatic

Check if a component exists using the Type specification

◆ HasComponent< T >()

static bool JUtils.ComponentExtensions.HasComponent< T > ( this Component  self)
inlinestatic

Check if a component exists on the components game-object

◆ HasLayer()

static bool JUtils.ComponentExtensions.HasLayer ( this Component  comp,
int  layer 
)
inlinestatic

Compare if a gameObject has a layer

◆ TryGetComponentInChildren< T >()

static bool JUtils.ComponentExtensions.TryGetComponentInChildren< T > ( this Component  self,
out T  component 
)
inlinestatic

Try get a component in the children

Type Constraints
T :Component 

◆ TryGetComponentInDirectChildren< T >()

static bool JUtils.ComponentExtensions.TryGetComponentInDirectChildren< T > ( this Component  self,
out T  component 
)
inlinestatic

Try get a component in in the direct children of this component

Type Constraints
T :Component 

The documentation for this class was generated from the following file: