Пример #1
0
    private void TestPacker()
    {
        List <Image> imageList = new List <Image>();

        canvas.GetComponentsInChildren <Image>(imageList);
        spriteList = new List <Sprite>(imageList.Count);
        List <Texture2D> texture2DList = new List <Texture2D>(imageList.Count);

        foreach (Image image in imageList)
        {
            spriteList.Add(image.sprite);
            texture2DList.Add(image.sprite.texture);
        }

        baseAgent = new BaseAgent();
        baseAgent.SetFilterMode(FilterMode.Point);

        if (baseAgent.GenerateAtlas(texture2DList, null))
        {
            rt = baseAgent.RenderToRT();
        }

        baseAgent.ReplaceImage(imageList);
        baseAgent.Release(true);
    }