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
- Resetting Quality Levels in Project Settings adds new Quality Levels instead of restoring default ones
- UI builder uxml files retain reference to non-existing assembly definition file when a assembly definition file is deleted
- Animator Entry and Base Layer Transitions links to the documentation aren’t working
- Caret doesn't appear when clicking the Input Field on secondary monitor
- “Move Up/Move Down” menu items does not reorder Schemas in AddressableAssetGroupTemplate Asset in Inspector
This is a duplicate of issue #731151