tk2dSlicedSprite.Awake C# (CSharp) Method

Awake() private method

The anchor position for this sliced sprite
private Awake ( ) : void
return void
    new void Awake()
    {
        base.Awake();

        // Create mesh, independently to everything else
        mesh = new Mesh();
        mesh.hideFlags = HideFlags.DontSave;
        GetComponent<MeshFilter>().mesh = mesh;

        // This will not be set when instantiating in code
        // In that case, Build will need to be called
        if (Collection)
        {
            // reset spriteId if outside bounds
            // this is when the sprite collection data is corrupt
            if (_spriteId < 0 || _spriteId >= Collection.Count)
                _spriteId = 0;

            Build();

            if (boxCollider == null)
                boxCollider = GetComponent<BoxCollider>();
        }
    }