Ejemplo n.º 1
0
    private void Awake()
    {
        sprite = TextureColor32.Pooler.Instance.GetSprite(512, 512);
        sprite.SetPixelsPerUnit(512);
        sprite.Clear(Color.clear);
        sprite.mTexture.Apply();

        drawing.sprite = sprite.uSprite;

        collider = drawing.GetComponent<Collider>();
    }
Ejemplo n.º 2
0
    private void Awake()
    {
        // create a 512x512 pixel canvas to draw on
        canvasSprite = TextureColor32.Pooler.Instance.GetSprite(512, 512);
        // tell unity that for every 512 pixels wide this sprite is, it should
        // be one world unit wide
        canvasSprite.SetPixelsPerUnit(512);
        // fill the sprite with transparent pixels
        canvasSprite.Clear(Color.clear);
        // update the real unity texture so that it can be displayed
        canvasSprite.mTexture.Apply();

        // set the existing SpriteRenderer to use the newly created sprite
        drawing.sprite = canvasSprite.uSprite;

        collider = drawing.GetComponent<Collider>();
    }