Search Issue Tracker
By Design
Votes
0
Found in
2018.3.0b2
2019.1.0a1
2019.1.9f1
2019.2.0a1
2019.3.0a1
Issue ID
1176821
Regression
No
Prefabs lose their Textures in the Build when their are Instantiated
Steps to reproduce:
1. Open user's attached project "ww2-unity-rts-game.zip"
2. Build the project
3. Select an Excavator looking GameObject in the Scene
4. Select one of the options displayed in Canvases
5. Place a GameObject(Building)
6. Notice that the Building does not have any Textures on them
Expected results: Instantiated GameObject are displayed with their Textures
Actual results: Instantiated GameObjects lose their Reference to their Textures
Reproducible with: 2018.3.0b2, 2018.4.7f1, 2019.1.14f1, 2019.2.2f1, 2019.3.0a12
Notes: This issue only exists in the Build. Prefabs brake in this project in versions lower than 2018.3.0b2
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
Resolution Note:
The problems comes from user's code changing the shader on the affected object's materials:
In ButtonManager.cs if the following two section are outcommented the issue does not reproduce.
foreach (Material mat in bldg.GetComponent<Renderer>().materials)
{
mat.shader = Shader.Find("Transparent/Diffuse");
mat.color = new Color(mat.color.r, mat.color.g, mat.color.b, 0.5f);
}
and
foreach (Material mat in bldg.GetComponent<Renderer>().materials)
{
mat.shader = Shader.Find("Standard");
mat.color = new Color(mat.color.r, mat.color.g, mat.color.b, 1f);
}
The problem that the Player behaves differently than in the Editor likely comes down to "Transparent/Diffuse" is not part of the assets build for the Player since it is only referenced by a string here.