private static void RenderPreviewAtlas(RenderTexture rt, GBillboardCreatorArgs args) { Clear(rt, Color.clear); if (args.AtlasMaterial == null) { return; } args.Mode = GBillboardRenderMode.Atlas; Vector2 viewPortSize = new Vector2(1f / args.Column, 1f / args.Row); Vector2 viewPortPosition = new Vector2(0, 0); RenderTexture tempRt = new RenderTexture(Mathf.RoundToInt(viewPortSize.x * rt.width), Mathf.RoundToInt(viewPortSize.y * rt.height), 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); Camera cam = CreatePreviewCamera(args); cam.targetTexture = tempRt; GameObject g = CreatePreviewGameObject(cam.transform, args); int imageCount = args.Row * args.Column; float angleStep = 360f / imageCount; for (int y = 0; y < args.Row; ++y) { for (int x = 0; x < args.Column; ++x) { Clear(tempRt, Color.clear); g.transform.rotation = Quaternion.Euler(0, GUtilities.To1DIndex(x, y, args.Column) * angleStep - 90, 0); cam.Render(); viewPortPosition = new Vector2(x * viewPortSize.x, y * viewPortSize.y); GCommon.DrawTexture(rt, tempRt, new Rect(viewPortPosition, viewPortSize), GInternalMaterials.UnlitTransparentMaterial); } } cam.targetTexture = null; GUtilities.DestroyGameobject(cam.gameObject); GUtilities.DestroyGameobject(g); tempRt.Release(); GUtilities.DestroyObject(tempRt); }