コード例 #1
0
 public void PasteMaterialOnCenter(Texture2D material, Vector2Int pos)
 {
     MaterialTexture.Paste(
         texture,
         blueprintMask,
         material,
         pos - new Vector2Int(material.width / 2, material.height / 2));
 }
コード例 #2
0
    public void UpdateSprite()
    {
        bool[,] shapeMask = MaterialShape.PolygonFillMask(512, 256, MaterialShape.square, true);
        Texture2D shape = MaterialTexture.CreateTextureFromMask(
            shapeMask,
            nyan,
            new Vector2Int(x, y));

        blueprint = MaterialTexture.Copy(origBlueprint);
        MaterialTexture.Paste(blueprint, mask, shape, Vector2Int.zero);

        GetComponent <Image>().sprite = Sprite.Create(
            blueprint,
            new Rect(0, 0, blueprint.width, blueprint.height),
            new Vector2(0.5f, 0.5f));
    }