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
- SerializeReference does not update references when the generic field type changes
- Memory leak when running tests in IL2CPP with System.Threading.Timer
- Tile Palette Tilemap dropdown icons are not visible
- Create New Tile Palette dropdown text is not centered and text is cut off
- Volume numeric fields allows adding unlimited number in numeric field which breaks UI, no character limit
This is a duplicate of issue #731151