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

你可能感兴趣的:(unity入门)