Monster shadow

VIDEO

Placing 3D objects on a Unity canvas

Description:
Ever wondered how to add a 3D object to your Unity canvas? This is great for screens like weapon select, inventories, skins, etc. I see this question asked a lot so figured I'd make a quick tutorial on the matter.
ADD A COMMENT

Tarodev
Helpful? *Let me know* so I can continue making useful content!
Bplus
In Unity 2021 and with URP things are working a bit differently, but it helped me. Would love to watch more content of you :)
BulbaChico
the type of content my adhd needs, learning unity in small steps is so hard because every part of the way there are details not to be forgotten about, learning something advanced like your tutorials allows us to be familiar with the workflow in order to get used to the notions like your very wise use of pre-created layers(UI Layer)
Ɱr. ƤiYửşḩ Ợfficial
This helped a lot
Rafaelski Arte Portfolio
PERFECT
atakan höbek
This man alwasy solve my problem. Thankss a lot...
ATK 0L
thank you soo much you are a life saver
Aleksandrs Grigorjevs
Its working only for primitives, like cube and so on? I tried with my 3d model, and its not visible :(
Tarodev
@Aleksandrs Grigorjevs No, you are right there will be a bit of a delta in this case. It shouldn't be too much as we're using a screen space camera with elements similar to our actual GameObjects. If you find yourself in a bit of a problem with it, the best way to fix it would be a startup script which checks screen dimensions and lerps the scale of the 3d object between min and max sizes.
Aleksandrs Grigorjevs
@Tarodev what do you mean of "parent scale"? e.g. if my 3d model under some ui panel, and by default panel scale will be (1,1,1). When screen size changes, canvas automatically scales all elements if Scale match mode set to Scale with Screen Size. But panel scale will be same (1,1,1). Or i don't understand something..
Tarodev
@Aleksandrs Grigorjevs hmm good question.. I figured the parents scale would be enough. I made a UI about a year back with 3d elements which seemed to work for all sizes without any fixes. Are you experiencing something different?
Aleksandrs Grigorjevs
@Tarodev yes :) one more thing, I always select match mode: Scale with Screen size. And everything on UI scales automatically. But with 3d objects, seems to need to think about some workaround. Have you thought about this already?
Tarodev
@Aleksandrs Grigorjevs ohhhhh baby! Glad you fixed it 👍
Ndna
Thank you, that worked wonderfully. Don't forget to stack your cameras by changing the Depth setting in output tab from 0 to 1 on your canvas camera
Tarodev
Glad it worked for you :) Happy coding
KF3D
In case someone else watched this video, read the comments or other forum posts on the unity website, and is now thinking this doesn't work in HDRP, then proceeds to spend hours trying to use the compositor tool for HDRP. Don't waste your time, the above workflow works perfectly fine in HDRP. Thanks for the clear and quick tutorial.
Ndna
Great thank you !
Tarodev
Pinned. Thank you
Zoltán Kóczán
Thanks for the tutorial!
Tarodev
Good luck! :)
AleX Mazureac
Thank you dude!
Why
What about HDRP? From what I understand this sort of multi camera setup would be unsupported.
Why
@Tarodev Camera stacking is only supported in URP not HDRP
Tarodev
Hey, I just pinned a comment with some advice 😊
Çağlar
For those who can't do it on URP, Unity has a tutorial called "Camera Stacking in Unity with URP! (Tutorial)" But still tutorial video thank you so much!
Ndna
Hope it works with HDRP, thank you for the advise :)
Victor Dev
Thanks!!!!! Worked for me!
Zoltán Kóczán
Thanks! It's Helped!
Tarodev
Thanks for the advice. Pinned.
That One Guy
How would you go about doing this with UI Builder/UI Toolkit stuff? I can't seem to get that working right
Tarodev
@That One Guy I'll have to give it a shot and see how it compares to the traditional way
That One Guy
@Tarodev I only just started trying it the other day, barely dipped my feet in the water. Although even with so little experience it's given me some UI that I would at least consider usable. Haven't really given UI a decent try other than with UI Builder so hard to compare.
Tarodev
I've actually never used UI Builder. Is it good?
Hippy Diggy
Hi, may i know how you did that globe effect where there is an image inside?
Tarodev
I'm using reflection probes to reflect the sky map (sky map is not actually visible in the sky). I'll be releasing a video on reflection probes soon 😊
ラシードファルハン
Liked and subscribed bro!
Tarodev
Appreciate it my guy
Dmitry Wroclaw
Great! Thank you very much! You save my game :) I was looking it year ago, but only now see so easy and effective totorial. Will use it :)
Water Cat
I use unity atlest 5 years and i don't know the is probably
Tarodev
And now you do!
anDarky
Good idea
Finlay Whitfield 3D Designer and Maker
This was a really clear tutorial, well spoken and easy to follow. Thank you for taking the time to do this!
SEE ALL COMMENTS


Transcript:

hey guys so you've got your game made you've got a ui and you've got some ui
elements let's change this one here to be a 3d
object so the first thing you need to do is go
to your canvas and change it from overlay to camera now it's telling
us we need a camera to render this canvas so let's create a brand new
camera and we'll call it canvas camera
now on this camera change the clear flags to depth only
change the culling mask to only render the ui
change it from perspective to orthographic
go back to your canvas and drag in that new canvas camera
change plane distance down to about 10. and now we can grab our camera and we
can move it to the side a little bit just to keep it away
now so next is to change this image
to a 3d object so let's delete the image and i'll create a new empty here and
i'll call it object parent and i'll just move it in front a
little bit like that now i've got this cube here
it's just a cube with a script on it that rotates the cube
nothing different than just a normal cube
i'm just going to drag that on just going to zero it out to make it in the
center and now i'm going to take the object
parent and i'm going to scale it all the way up
until we can see it ah and one more thing
your cube also needs to be on the ui layer
like that let's scale it out to where i want it
remove it and if you can see this the the cube is being rendered here in
the background too and that's because our main camera
we need to remove ui from the coloring mask
okay and now that should actually be it it's gonna speed up the rotate
and there you go a 3d object on your canvas
so if you learned something give it a like maybe subscribe
i'm going to be making a lot of these quick tutorials so stay tuned
you