I’ve been studying the following example but I have 2 problems that I can’t seem to solve:
Question 1) the images on each button/sprite don’t work. I tested several .png files but the checkerboard remains with each image, and it’s covered with a semi-transparent white shade. Perhaps it’s an image scaling issue, but then why is the checkerboard still visible behind the image? Even better, is there a way to make the entire SPRITE an image? Like this playground? https://www.babylonjs-playground.com/#XCPP9Y#3281
Question 2) trying to pinpoint the BUTTON name or SPRITE name, so I can control the action in the onPointerDown callback. I’ve used the following format before to catch actions (see line #104 in playground above)
this usually works —> (pickinfo.pickedMesh.name == “button6”) or (pickinfo.pickedMesh.name == “b6”)
but it’s not working in this example above. How can I access the sprite/button and catch the action in the onPointerDown callback? The material line seems to work fine in the example…
They’re all 404 in the console for that playground, so I’m not sure what you’re seeing that makes them semi-transparent. I updated your playground to use the ‘textures/player.png’ sprite provided by the playground server and it looks correct.
Question 2) trying to pinpoint the BUTTON name or SPRITE name, so I can control the action in the onPointerDown callback. I’ve used the following format before to catch actions (see line #104 in playground above)
this usually works —> (pickinfo.pickedMesh.name == “button6”) or (pickinfo.pick> edMesh.name == “b6”)
but it’s not working in this example above. How can I access the sprite/button and catch the action in the onPointerDown callback? The material line seems to work fine in the example…
Thank you, that is great! It seems that the sprite element overrides the button in this example. I thought it was the reverse. Final question then - How can I clear the entire structure?
is it something like this ? ```
You want to clear them definitely, or just make them invisible? If you want to clear definitely, you can use spriteManager.dispose(). If it’s just to make them invisible, you can set isVisible = false on each sprite.
Hi - i want to toggle the visibility so I can open or close the menu on-demand. Turns out the solution was to access the sprite array AND meshes in the following way. Solution is unique to this particular playground: