Closed Specy closed 2 years ago
Not sure why yours isn’t working, but it might be the way you create the actual texture, here’s a working demo:
https://codepen.io/specy-the-bold/pen/eYeXvdx?editors=0110 Here it shows the problem, i think that the texture needs to come from the same renderer for it to work, i tried to use a third pixi app to render it and then add it to the second app, and that also didnt show up.
Do you know some other feature i could use to get a similar outcome? Im just trying to create my own texture to then use it in a sprite. Alternatively, can i get a reference of the renderer used in the react Pixi stage and then use that to generate the cache?
Sure you can use the useApp
hook and get the app renderer:
Forgot to mention that I'm using class components so I'll have to use ref I guess, I'll see what I can do. Thanks for the help!
For anyone which might need this in the future, yes the issue was that you can render only a texture that comes from the same renderer. If you want to create your own cache, get the ref of the app from the stage, then use that to generate the textures
Im using a pixi app to create my own textures (in this case basic rectangles) that i then use in the sprites. Sort of a cache I previously used canvas and converted it to a URL to then use that url as image of the sprite, but i now wanted to convert that to a pixi app to have more "control" of how i create things
I generate the texture like this:
and use it like this in the react component:
But this doesnt show anything in the stage, its all transparent. I tried to use a normal canvas and the pixi instance i used to create the cache and doing this works:
what could be the issue? i cant find anything in the docs about this
@inlet/react-pixi
version: 6.6.5React
version: 17.0.2ReactDOM
version: 17.0.2PIXI
version: 6.1.3