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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
This is a duplicate of issue #731151