Search Issue Tracker
Duplicate
Votes
2
Found in
5.4.0a2
Issue ID
747286
Regression
No
[WebGL] CreatePrimitive fails to create required components
1. What happened
- Created a scene with a an object and a script that calls GameObject.CreatePrimitive(PrimitiveType.Cube)
- Built for WebGL
- Ran webgl build which failed to create the cube
2. How we can reproduce it using the example you attached
- Build and Run for WebGL
- Notice no cube on screen
open browser console you'll see:
Can't add component because class 'MeshFilter' doesn't exist!
Can't add component because class 'BoxCollider' doesn't exist!
Can't add component because class 'MeshRenderer' doesn't exist!
if you then, disable "Strip Engine Code", and rebuild. it will work fine.
Comments (7)
-
riqmariz
May 14, 2019 19:06
That helped me, thanks.
-
ensomniac
Feb 01, 2017 00:11
This is also evident in 5.5.0f3 - super frustrating
-
JoeStrout
Jul 02, 2016 13:55
It also occurs in 5.3.4. And Unity, if you're going to tell us this is a duplicate, it should would be great if you would include a link to the bug it's a duplicate of!
Note to others who trip over this bug: another work-around is to just add private MeshCollider, MeshFilter, and MeshRenderer properties anywhere in your code. It will then work even with Strip Engine Code checked.
-
kd7uiy
Jan 15, 2016 14:55
Note that this issue also occurs in 5.3.1.
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
- [Linux] Navigating Prefab Components in Overrides window shows rendering artifacts in the Editor
- Prefab Overrides window cuts-off Component labels across multiple Components
- Opening Memory Settings documentation from Project Settings window opens missing page
- Animated GameObjects ignore Shader keywords when running on VisionOS Player with Polyspatial
- Quickly clicking "Open query in Search Window" in the Hierarchy twice opens the two Search tabs at the same time
This is a duplicate of issue #731151