What is SpriteRenderer
SpriteRenderer is a component inherited from MonoBehaviour. It can attach sprites and commit sprites to EasyMotion2D's sprite rendering pipeline.
How to use
SpriteRenderer members in Inspector
-
Current frame
-
The first sprite attach to the SpriteRenderer. Usually use in a simply sprite.
-
-
Sprite Selector
-
Click a sprite in sprite selector can be set the current frame to SpriteRenderer.
-
Double-click a sprite in sprite selector can set the current frame and close the selector window quickly.
-
Click the “None” button in right-top of selector window can set current frame to no select sprite.
-
-
-
-
Visible
-
Viisble decide a Sprite can be render in scene or not.
-
-
RenderMode
-
RenderMode decide how to rendering a sprite.
-
-
Color
-
The color of the sprite.
-
-
UpdateMode
-
Update Mode use to decide where to call the SpriteRenderer.Apply function.
-
The SpriteRenderer.Apply use to commit sprite's propertys change for rendering. That means if you change any property of SpriteRenderer or change transform's property on parent gameobject, you should call SpriteRenderer.Apply.
-
If update mode is none, then you need call SpriteRenderer.Apply manually in your code.
-
-
Depth
-
Depth decide how the sprites sorting in rendering pipeline in the same layer.
-
Depth value range is 0-512, value more less, it will rendering more late.
-
-
Plane
How to define occlusion between SpriteRenderers
-
EasyMotion use the gameobject's layer and SpriteRenderer's depth to decide how a sprite's occlusion with others.
-
-
EasyMotion2D use layer 16 to layer 32 decide sprite's depth.
-
If gameobject's layer less than 16, then it same as the layer 16.
-
If gameobject in the same layer, you should use the depth member in SpriteRenderer.
-
SpriteRenderer FAQ
-
I add a sprite in scene, but i can't see it in game view?
-
In this case, please check the SpriteRenderer follow steps:
-
Is these a gameobject with a Camera2D component in the scene? If no, will not renderering any sprite in the Scene.
-
Do you select a sprite to the current frame of the SpriteRenderer? If no, will skip this sprite when rendering.
-
Do you select a RenderModeSetting to the renderMode of the SpriteRenderer? If no, will skip this sprite when rendering.
-
Do you set a color with 0 alpha to the color of the SpriteRenderer? If yes, you will can not see the sprite, because it will full transparent.
-
Do you set the cullFlag of Camera2D but sprite's layer not one of these layers? If yes, will skip this sprite when rendering.
-
Do you set the clipping of Camera2D and sprite out of the viewport? If yes, will clipping this sprite when rendering.
-
-