Catlike Coding
Unity Code Documentation
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
CatlikeCoding.Clipping.ClippedSlicedSprite Class Reference

Sliced spite that is also a clipped element. More...

Inherits CatlikeCoding.Clipping.ClippedElement.

Public Member Functions

void UpdateSlicedSprite ()
 Update the sliced sprite's mesh. More...
 
- Public Member Functions inherited from CatlikeCoding.Clipping.ClippedElement
void InitializeClipHierarchy ()
 Initialize the clip hierarchy. This method is already called at the appropriate places, you typically should have no reason to call it yourself. More...
 
void UpdateClipHierarchy ()
 Update the clip hierarchy if this element's parent changed. Call this method after changing the transform parent of this element, if it was or is now part of a clip hierarchy. More...
 
void UpdateHierarchyBounds ()
 Update the bounds of the entire clip hierarchy that this element is a part of. More...
 

Public Attributes

Vector4 border
 The size of the border. More...
 
SlicedSpriteBorderMode borderMode
 How to interpret the border size. More...
 
Color color = Color.white
 Color to tint the sprite with. More...
 
float pixelsPerUnit = 1f
 How the texture's pixels relate to units. This influences the size of the border. More...
 
int sortingOrder
 Sorting order, which you can use to make sure some spites are always rendered on top of others. More...
 
Texture2D texture
 Texture to show. More...
 
- Public Attributes inherited from CatlikeCoding.Clipping.ClippedElement
bool clipsChildren
 Whether the element uses its content bounds to clip its children. More...
 
bool notifiesParent = true
 Whether the element notifies its parent when its bounds have changed. More...
 

Protected Member Functions

override void OnClipBoundsChanged ()
 Called when the clip bounds have changed, because the hierarchy bounds have changed. More...
 
override void OnContentBoundsChanged ()
 Called when the content bounds have changed, by setting ContentBounds. More...
 
override void OnDestroy ()
 Called by Unity when the component is destroyed. More...
 
override void OnEnable ()
 Called by Unity when the component is enabled. More...
 

Additional Inherited Members

- Protected Attributes inherited from CatlikeCoding.Clipping.ClippedElement
Bounds2D clipBounds
 Clip bounds. More...
 
List< ClippedElementclipChildren
 Clip children. More...
 
ClippedElement clipParent
 Clip parent. More...
 
Bounds2D contentBounds
 Content bounds. More...
 
- Properties inherited from CatlikeCoding.Clipping.ClippedElement
Bounds2D ClipBounds [get]
 Get the clip bounds. More...
 
Bounds2D ContentBounds [get, set]
 Get or set the content bounds. More...
 
Bounds2D ContentBoundsForParent [get]
 Get the content bounds for use by the element's direct parent. More...
 

Detailed Description

Sliced spite that is also a clipped element.

Represents a sprite that is split into nine segments. Also known as a scale9 or bordered sprite. The sprite is rendered with a 16-vertex mesh.

Member Function Documentation

override void CatlikeCoding.Clipping.ClippedSlicedSprite.OnClipBoundsChanged ( )
protectedvirtual

Called when the clip bounds have changed, because the hierarchy bounds have changed.

Does nothing. Override if you need to respond to this change.

Reimplemented from CatlikeCoding.Clipping.ClippedElement.

override void CatlikeCoding.Clipping.ClippedSlicedSprite.OnContentBoundsChanged ( )
protectedvirtual

Called when the content bounds have changed, by setting ContentBounds.

Does nothing. Override if you need to respond to this change.

Reimplemented from CatlikeCoding.Clipping.ClippedElement.

override void CatlikeCoding.Clipping.ClippedSlicedSprite.OnDestroy ( )
protectedvirtual

Called by Unity when the component is destroyed.

Subclasses with their own OnDestroy functionality should override this method and call this base version. It ensures that the clip hierarchy stays valid.

Reimplemented from CatlikeCoding.Clipping.ClippedElement.

override void CatlikeCoding.Clipping.ClippedSlicedSprite.OnEnable ( )
protectedvirtual

Called by Unity when the component is enabled.

Subclasses with their own OnEnable functionality should override this method and call this base version. It ensures that clip hierarchy gets initialized.

Reimplemented from CatlikeCoding.Clipping.ClippedElement.

void CatlikeCoding.Clipping.ClippedSlicedSprite.UpdateSlicedSprite ( )

Update the sliced sprite's mesh.

Member Data Documentation

Vector4 CatlikeCoding.Clipping.ClippedSlicedSprite.border

The size of the border.

X is left, Y is bottom, Z is right, and W is top.

SlicedSpriteBorderMode CatlikeCoding.Clipping.ClippedSlicedSprite.borderMode

How to interpret the border size.

Color CatlikeCoding.Clipping.ClippedSlicedSprite.color = Color.white

Color to tint the sprite with.

float CatlikeCoding.Clipping.ClippedSlicedSprite.pixelsPerUnit = 1f

How the texture's pixels relate to units. This influences the size of the border.

int CatlikeCoding.Clipping.ClippedSlicedSprite.sortingOrder

Sorting order, which you can use to make sure some spites are always rendered on top of others.

Texture2D CatlikeCoding.Clipping.ClippedSlicedSprite.texture

Texture to show.