Open itsyoboieltr opened 9 months ago
Try wrapping the component with Canvas
import React from 'react';
import { Canvas } from 'react-three-fiber';
import { useTexture } from '@react-three/drei';
function Test() {
const sprite = useTexture(require('./sprite.png'));
return (
<mesh>
<planeBufferGeometry attach="geometry" args={[1, 1]} />
<meshBasicMaterial attach="material" map={sprite} />
</mesh>
);
}
export default function App() {
return (
<Canvas>
<Test />
</Canvas>
);
}
Thank you for contributing! We’re marking this issue as stale as a gentle reminder to revisit it and give it the attention it needs to move forward.
Any activity, like adding an update or comment, will automatically remove the stale label so it stays on our radar.
Feel free to reach out on Discord if you need support or feedback from the community. This issue will close automatically soon if there’s no further activity. Thank you for understanding and for being part of the project!
three
version: 0.161.0@react-three/fiber
version: 8.15.16@react-three/drei
version: 9.97.0node
version: v20.9.0npm
(oryarn
) version: 10.1.0Problem description:
I am trying to load a sprite, but it errors.
Relevant code:
Suggested solution:
Maybe I am misusing it? but I would expect this to work.