Particles are in front of UI elements in unity - unity3d

So all i'm looking for is simple. I want the UI elements such as Buttons/Logo/..etc to be in front any particle effects in the Canvas.
In the answer Here someone suggested to add a canvas component to each and every UI element I want to show in front of the particles and that work somehow the only problem in this way the buttons won't click at all.
All elements are on the default sorting layer including the particles object and the camera.
Is that hard to do that?
Please help.

set "Order in layer" of Particles to 0 and UI elements to 1 or a better way of doing this is to go to add new layers, create a foreground and background layer, set foreground to 1 and background to 0 and then change from the default layer to which ever you want in front or back.

My solution was to change the material I was using in the particle system. Change "Sprite-Default" to a material with "Rendering Mode" Opaque and "Shader" to "Standard".

Related

Unity problem with ordering and sorting layers

I've some problems with Unity layers. Before was everything ok, now, I don't know why the game view show some elements behind. Has you can see in the image the red background in the game view isn't visible even if it has the same sorting layer has the text and its order in layer is fewer.
So, it would be helpfull if you would also share screenshots of the components you use, like SpriteRenderer...
Also, also, maybe show the layers you have configured.
Here is one setup for example:
You can configure which sorting layers you want and in what order
After that in your Render Component of Choice you can set this layer and use the number (order in layer) for finer sorting
Finally I solved removing the sprite renderer for the background of the parent of the texts and I putted a separated sprite square for all the background with a order fewer

How to Create a Blocking Mask in Unity using Image Components?

I'm designing a tutorial for a Unity game and am stuck at what seems like a trivial problem. For every step in the tutorial, I guide the user by hiding everything on the screen except the buttons they need to press. My game hierarchy looks like this.
Button Canvas
Select_Me_Button
Dont_Select_Me_Button
Tutorial Canvas
Mask Group 1
Left Border Mask
Right Border Mask
Up Border Mask
Down Border Mask
Mask Group 2 ...
The TutorialCanvas GameObject has a Canvas component with a higher sorting order than ButtonCanvas. I added GraphicRaycaster Component with Blocking Mask set to everything and Blocking Objects set to None for the TutorialCanvas. However, even though TutorialCanvas renders on top of Button Canvas, I am still able to click through the mask and trigger buttons that are not supposed to be clickable. I was able to block clicks by adding image components functioning as masks to parent objects Mask Group 1 and Mask Group 2 belonging to TutorialCanvas, but this is not desirable, because I need to group the image components to create a mask, and gameobject can only accept 1 image component.
I'm having a hard time imagining this is so hard. I just need one canvas with a mask to block clicks going to a canvas behind it.
Thanks to the help on Unity Forum I solved the issue by creating a single group of masks and positioning them via RectTransform's anchoredPosition component in script.

Unity - Guidelines for color isolation effect

I would like to highlight two objects in Unity so that they stand out. But instead of actually highlighting them, which I already know how to do, I would instead like to have some kind of color isolation effect, like the one we can see in the picture below :
However, I really have no idea about how I could acheive this !
Could I use some post processing effects to remove the saturation, expect for a set of objects ?
Should I instead desaturate all the materials of all the objects in the scene and also desaturate the sun color ?
Should I apply to all the other objects in the scene a shader that only renders grayscale colors ?
Could you point me into the right direction ? Thank you.
One approach would be:
- Add a desaturate post process to your main camera and set its culling mask to everything(but turn off the effect)
- Create a second camera, make it a child of the first one (so it keeps the same rotation and position) and set its culling mask to something else (a layer where you will place your highlighted objects)
- When an object needs to be highlighted, add it to the highlights layer and desaturate the main camera. The object will stay colored because it is rendered by the camera that does not have the desaturation effect.
You'll have to play with the "Clear Flags" option of both cameras to get this to work correctly
Still using LWRP Post Processing stack, but I'd add a Color Grading effect and use that to 'tune' your unwanted colours to grey.

Unity3D - Set a (foreground) UI layer which ignores mouse clicks?

I'm currently writing up a UI-Centric game, and I've added a small image overlay over some elements on screen. However, the problem is that now I can't click any buttons behind this overlay image, regardless of transparency etc.
Just to chance it, I set up a new layer called "noUIclick" and set it to ignore every other layer under physics settings - long shot I know, but no dice. Tried also simply swapping to 3D view and moving the overlay image back on the z-axis.
Is there any easy way to set a layer for UI components which will entirely ignore/allow for passthrough of mouseclicks onto the buttons in the background?
On the Image component, uncheck raycastTarget.

how to make background or how to arrange a sprite backwards

I just want to make a background but when I tried to pull a background photo in, it's in front of all the other sprites, so how can you make it go backwards.
You have 2 ways for that. The easiest would be just to change the z-order of the background to a value greater than your other sprites. For instance when you have a character and a background you would use 1 for the backgrounds z-order and 0 for the characters z-order.
So just click on your background sprite and in the inspector type 1 for the z-poition. Same for your character or whatever sprite you have, but this time make sure its 0 in the z-position.
The better approach is ofcourse to use layers. When you click on a sprite you will see a sprite component in the inspector attached to it by Unity automatically. In this component there is a "Order in Layer" property".
Now if you change the backgrounds order in layer property to -1 and all your other sprites have a greater value for example 0,1,2.... then the background will be pushed to back as this is its order in that particular layer.
You can also use the sorting layer property and add your own layers. Its probably the best method, but the 2 above should get you achieve what you want.