Search Issue Tracker

Duplicate

Votes

2

Found in

5.4.0a2

Issue ID

747286

Regression

No

[WebGL] CreatePrimitive fails to create required components

WebGL

-

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.

  1. This is a duplicate of issue #731151

    [IL2CPP] Creating primitive results in crash

Comments (7)

  1. riqmariz

    May 14, 2019 19:06

    That helped me, thanks.

  2. ensomniac

    Feb 01, 2017 00:11

    This is also evident in 5.5.0f3 - super frustrating

  3. 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.

  4. kd7uiy

    Jan 15, 2016 14:55

    Note that this issue also occurs in 5.3.1.

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.