Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layer mask not working #16

Open
rallianto opened this issue Feb 7, 2020 · 4 comments
Open

Layer mask not working #16

rallianto opened this issue Feb 7, 2020 · 4 comments

Comments

@rallianto
Copy link

Decal data -> Projection Options -> Layer mask -> Pick anything other than 'Everything', and decals don't show up.

Playing around with your decals solution, and it's very impressive. I'm looking to use it for spell/skill indicator on ground, and don't want to project on anything else than the ground. However, when I put the ground object on "Ground" layer, and go Decal data -> Projection Options -> Layer mask -> "Ground", the decal just disappears. The only way I can get decals to show is having Layer mask -> "Everything"

@rallianto
Copy link
Author

Playing around a little more I've found out that's it's only with custom layers it doesn't work. If I use the build in layers I can pick and choose what to paint decals on. But if you make you own layer, set an object on that layer and set Decal data -> Layer mask -> "Your own layer" , it won't work

@bfod
Copy link

bfod commented Mar 21, 2020

I've also seen this.

@mitoand9
Copy link

Yes, unfortunately I bumped into the same issue.
This is happening because Unity eliminates some of the default layers.
To solve this, do the following:

  1. Go to the layers and count the number of empty default fields (layers which are not editable and are empty). Let's call this number "N"
  2. Open the script DecalDataEditor and go to line 178. Multiply (LayerMask)m_LayerMaskProp.intValue by N
  3. Go to line 181 in the same script and substitute the line with m_LayerMaskProp.intValue = (int)(tempMask*N) where N is the number which you previuously defined
  4. Now you are good to go. The Layer Mask should work on all the custom layers, but it won't work on the default layers

@AlmostInteractive
Copy link
Contributor

@mitoand9 @rallianto

Replace DecalDataEditor.cs line 178 with:

LayerMask tempMask = EditorGUILayout.MaskField(Styles.LayerMask, InternalEditorUtility.LayerMaskToConcatenatedLayersMask((LayerMask)m_LayerMaskProp.intValue), InternalEditorUtility.layers);
tempMask = InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(tempMask);

and it should work for all layers, internal and added. There's a PR up to resolve this issue. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants