Search Issue Tracker

By Design

Votes

0

Found in

2020.3.41f1

2021.3.13f1

2022.1.22f1

2022.2.0b14

2023.1.0a18

Issue ID

UUM-18896

Regression

No

Documentation issue: Cube renders with an InternalErrorShader as its material will not be included when created using GameObject.CreatePrimitive

--

-

Reproduction steps:
# Open the attached project
# Open the “/Assets/Scenes/SampleScene.unity” Scene
# Build And Run the project (File > Build And Run)
# Observe the cube’s color in the Player

Expected result: The rendered cube is white
Actual result: The rendered cube is pink

Reproducible with: 2020.3.41f, 2021.3.13f1, 2022.1.22f1, 2022.2.0b15, 2023.1.0a18

Reproducible on: M1 MacOS 13.0 (22A380)

Notes:
* The Issue is reproducible on both Intel and Apple Silicon Editors on M1 Mac
* This is caused by the GameObject.CreatePrimitive method creating a renderer that references a material which is not included in the build

  1. Resolution Note:

    This is by design. What happens is that during a build Unity strips away all assets that is not referenced. This can cause problems for GameObject.CreatePrimitive if there are no other references to the material. The solution is to have an included object that refers to the material. We have updated the documentation to explain the issue as well.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.