Advanced
Legacy property for backwards compatibility with PixiJS v7 and below.
Use cacheAsTexture
instead.
Caches this container as a texture. This allows the container to be rendered as a single texture, which can improve performance for complex static containers.
If true, enables caching with default options. If false, disables caching. Can also pass options object to configure caching behavior.
// Basic caching
container.cacheAsTexture(true);
// With custom options
container.cacheAsTexture({
resolution: 2,
antialias: true,
});
// Disable caching
container.cacheAsTexture(false);
// Cache a complex UI
const ui = new Container();
// Add multiple children...
ui.cacheAsTexture(true);
ui.updateCacheTexture(); // Update if contents change
Readonly
isWhether this container is currently cached as a texture.
Updates the cached texture of this container. This will flag the container's cached texture to be redrawn on the next render.
The CacheAsTextureMixin interface provides methods and properties for caching a container as a texture. This can improve rendering performance for complex static containers by allowing them to be rendered as a single texture. It includes methods to enable or disable caching, update the cached texture, and check 1if the container is currently cached.