- Home /
Figured out the solution!
Transparency not working in build
I have two cubes, one is 0.2 bigger then the other cube. They are in the same position.
They are both using vertex color shader.
Shader "VertexColor" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
}
SubShader {
Tags {Queue=Transparent}
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
ColorMaterial Emission
}
}
Fallback "VertexLit", 1
}
In the editor, everything works fine! The cube in the center and outer cube both have the same percentage of alpha and color and I get this nice outline effect.
When I build, you cannot see the inner cube! I offset the outer cube to see what was happening. If I am above the two cubes, I can see part of the inner cube.
When I go below the cube, I can see the entire inner cube!
I cannot see why it works in the editor, but not in the build. (Most annoying glitches every!)
Thanks for any help!!
EDIT: The solution was to simply move the cube up by 0.1f. Thanks for everyone's help!
Unlikely an annoying glitch, more likely an expected result of having two objects close together. If you mean it looks different in the Scene view than the Game view, it's probably due to depth buffer precision if you're using a perspective camera. It's likely still a depth precision problem if you see the difference between the Game window and a full on build if the built version is full screen. In either case, reducing the far clip plane and increasing the near clip plane could help.
If using an orthographic camera, you probably shouldn't be seeing this. What and when are you seeing this?
It works perfect in the game/scene view ONLY when both cubes are on top of each other. If I offset the outer cube, (like the 2nd image in the OP) then it will clip the inner cube as shown in my OP in both build and editor.
I am using a perspective camera. The clip plane isn't the issue (I have near as 0.01).
It doesn't work in fullscreen.
Yes, orthographic camera fixes it.
The issue happens in the web and windows build (only ones iv tested so far). But like I said, if I offset the outer cube, it will also have the issue in the editor.
Thanks!
Follow this Question
Related Questions
Problems with Builds 1 Answer
Build Error 1 Answer
Game works fine in editor, but build fails with 59 error in the console 2 Answers
Input mapping in project setting lost when build 2 Answers
C++ Error After Automated Build 1 Answer