Is there a way I can make a dialogue box appear on top of a game object in a 3D game. I have tried using the canvas but that doesn’t seem to work. I want it to appear as if it is floating over the game object.
Hello,
there are several approaches. You can use standard GameObjects, but managing the text would be a tad trickier.
You can do it with canvas, by setting its Render Mode to World Space. You’d have to make sure it keeps facing the player.
This is the key, and this also usually this makes the box MASSIVE, like hundreds of units across, so I tend to make my WorldSpace canvases scaled down to 0.01 in all axes (X,Y,Z).
Then as diXime pointed out, use a billboarding script to point it at the player, and parent it to the unit to keep it together.
Attached is a handy start to making a dynamic UI that flows around arbitrary-sized text.
To see it in world space, do these steps:
- press PLAY
- select the canvas
- change it to World Space
- change its scale to (0.01, 0.01, 0.01)
- move its position to (0,0,0)
It should be visible right there in your 3D world and you can pause and look around.
7204534–865297–ExpandingCartoonBubble.unitypackage (21.3 KB)
Thank you so much for the reply this works perfectly.
Thank you. I implemented it and it works as intended.