This package provides flexible authoring possibilities to serve your purposes.
The most simple way is to use ready monobehaviour authorings from this package. Those authorings gives you all data assigning you need to render sprites withing pipeline of this package.
SpriteRendererAuthoring
- bakes default render components. Adds 2D transform components / removes unity default 3D transforms / adds sorting components.SpriteAnimatedRendererAuthoring
- same as previous, but also adds animation related components. Though not inherited from previous one (because it hard to keep all in place when you deal with unity serialization)
However you may want to implement your own register system or your own shader or some other components, I can never know.
So you may want to use authorings partially, for example you want to use only sorting bake part,
then you can use Authoring Modules which is just serialized types with Bake()
method.
So you can use SortingAuthoringModule
and other modules as a field in your custom authoring MonoBehaviour
class and call Bake()
in Baker<TAuthroing>
like
public class FooAuthoring : MonoBehaviour
{
private class Baker : Baker<FooAuthoring>
{
public void override Bake(FooAuthoring authoring)
{
aithoring.Sorting.Bake(this);
}
}
public SortingAuthoringModule Sorting;
}
Again however if modules doesn't fit your needs or have extra unnecessary data then you can still use Baker Extensions which is used by modules. So if you still want to use sorting but you, for example, don't need set any sorting data, because it constant, then you can do something like:
public class FooAuthoring : MonoBehaviour
{
private class Baker : Baker<FooAuthoring>
{
public void override Bake(FooAuthoring authoring)
{
this.BakeSpriteSorting
(
GetEntity(TransformUsageFlags.None),
SortingIndex,
SortingLayer,
UseStaticSorting
);
}
}
private const int SortingIndex = 0;
private const int SortingLayer = 0;
private const bool UseStaticSorting = false;
}
PropertiesSet
- contains properties components names with update strategy type (read more about properties and update modes). ThisScriptableObject
used by authoring / modules / extensions to bake registration data. You can create it by call context menu in projectCreate/NSprites/Properties Set
.SpriteAnimation
&SpriteAnimationSet
- scriptable objects, first contains animation data and second contains a set ofSpriteAnimation