Topic: Screen Space Camera?

Geetings,

I want to use the Screen space camera instead of Screen space overlay on the canvas
and get he scene camera to stay in the render camera property. Does anyone know how to do this?
Thanks for any intel.

Share

Thumbs up Thumbs down

Re: Screen Space Camera?

Oh, I just figured out how to do this the other day for my project! Here's how I did it.

in DefaultBattleGUI.cs At the top of

public override void OnShow ()

I just added

UFE.canvas.renderMode = RenderMode.ScreenSpaceCamera;
UFE.canvas.worldCamera = Camera.main;
UFE.canvas.sortingLayerName = "UI";

The last line there may not be needed for yourself, I was doing it so my characters could jump in front of the UI.

If that's what you're going for, I recommend giving all your UI elements a shader with ZTest Always. And if you want some UI elements in front of your characters, you should add a secondary canvas to your BattleGUI prefab with a different sorting layer, that's how I got it to work for me!

Anyways, best of luck!

Share

Thumbs up +3 Thumbs down

Re: Screen Space Camera?

@starcuttter. That worked Perfectly Thanks a million.

Share

Thumbs up Thumbs down

Re: Screen Space Camera?

@Starcutter I added the code but When I try to change the ZTest the bottom UI that holds my Special bars do not appear in front of my background. My game is 2D so that might be why. Do you have any suggestions?

Hey I'm making a dope fighting game I hope you'll play it one day

Share

Thumbs up Thumbs down

Re: Screen Space Camera?

B_LIN wrote:

@Starcutter I added the code but When I try to change the ZTest the bottom UI that holds my Special bars do not appear in front of my background. My game is 2D so that might be why. Do you have any suggestions?

Hmm, if your background is just a flat image, You may want to try messing with the sorting layers? Sorry if I'm not much help and good luck!

Share

Thumbs up +1 Thumbs down