Closed yzbaoo closed 2 years ago
import { Stage, Sprite } from '@inlet/react-pixi';
import * as PIXI from 'pixi.js';
export default () => {
console.log(PIXI.utils.TextureCache); // Sprite props is image, i can't log TextureCache. texture is ok
return (
<div className="pixi-page">
<Stage width={window.innerWidth} height={window.innerHeight}>
<Sprite
width={window.innerWidth}
height={window.innerHeight}
image="https://asset.txqn.huohua.cn/image/e82a8354-00cb-423c-aa89-ca6ac9212d6f.png"
texture={PIXI.Texture.from(
'https://asset.txqn.huohua.cn/image/e82a8354-00cb-423c-aa89-ca6ac9212d6f.png'
)}
/>
</Stage>
</div>
);
};
Hi @yzbaoo,
Please use Github issues for code bugs/feature requests only, these kind of questions can be asked in our Slack channel where the react-pixi community can help you.
To answer your question. If you'd like to control the texture it's best to not set the image
prop as this will create a texture for you. Instead use the texture
prop with your texture.
Example:
// create your texture somewhere
const texture = PIXI.Texture.from(
"https://asset.txqn.huohua.cn/image/e82a8354-00cb-423c-aa89-ca6ac9212d6f.png"
);
// and use it later in any sprite
<Sprite texture={texture}>
Description
i want to manage textureCache, but,when i use
<Sprite image="***">
, how do i get the textureCache or BaseTextureCache?Additional info
@inlet/react-pixi
version: 6.8React
:17ReactDOM
:17PIXI
version:6.4