Skip to content

CanvasTextPool

ClassChartGuruChartGuru
public class CanvasTextPool

Canvas TextMeshPro label pools organized by text category.

CanvasTextPool(Transform, ChartTheme, int, int)

Section titled “CanvasTextPool(Transform, ChartTheme, int, int)”
public CanvasTextPool(Transform parent, ChartTheme theme = null, int defaultCapacity = 10, int maxSize = 100)

Creates a new Canvas TMP label pool.

Parameters

Name Type Description
parent UnityEngine.Transform Parent transform for all pooled text objects.
theme ChartGuru.ChartTheme Optional theme for default styling.
defaultCapacity System.Int32 Initial capacity for each category pool.
maxSize System.Int32 Maximum pool size per category before items are destroyed.

public IChartTextRenderer Acquire(TextCategory category)

Acquires a text renderer from the pool for the specified category.

Parameters

Name Type Description
category ChartGuru.TextCategory The text category determining default styling.

Returns

ChartGuru.IChartTextRenderer — A text renderer, either from the pool or newly created.

public IChartTextRenderer Acquire(TextCategory category, string text)

Acquires a text renderer and sets its text content.

Parameters

Name Type Description
category ChartGuru.TextCategory
text System.String

Returns

ChartGuru.IChartTextRenderer — No return description is available.

public IChartTextRenderer Acquire(TextCategory category, string text, Vector2 position)

Acquires a text renderer with text and position.

Parameters

Name Type Description
category ChartGuru.TextCategory
text System.String
position UnityEngine.Vector2

Returns

ChartGuru.IChartTextRenderer — No return description is available.

public void Release(IChartTextRenderer renderer, TextCategory category)

Returns a text renderer to its pool.

Parameters

Name Type Description
renderer ChartGuru.IChartTextRenderer The renderer to release.
category ChartGuru.TextCategory The category pool to return it to.
public void ReleaseAll(List<IChartTextRenderer> renderers, TextCategory category)

Returns all active renderers in a list to their pool.

Parameters

Name Type Description
renderers System.Collections.Generic.List{ChartGuru.IChartTextRenderer}
category ChartGuru.TextCategory
public void Clear()

Clears all pools, destroying all pooled objects. Call this when the chart is destroyed.

public void Clear(TextCategory category)

Clears a specific category pool.

Parameters

Name Type Description
category ChartGuru.TextCategory
public int GetInactiveCount(TextCategory category)

Gets the count of inactive (available) renderers in a category.

Parameters

Name Type Description
category ChartGuru.TextCategory

Returns

System.Int32 — No return description is available.

public int GetTotalCount(TextCategory category)

Gets the total count (active + inactive) in a category.

Parameters

Name Type Description
category ChartGuru.TextCategory

Returns

System.Int32 — No return description is available.

public void Dispose()

No description is available for this member.