I want my to build my current project for WebGL. It was originally made for PC, Mac & Linux Standalone and therefore there were many parts of the programm (mainly about networking stuff) that had to be excluded.
For Scripts there are precompiler directives and for Plugins (.dll) there is the option to choose for which platform they should be included.
Now I’m facing the problem that I have the component NetworkView attached to 2 Prefabs and 1 Gameobject in the scene.
NetworkView is needed for the original platform build but the WebGL build won’t work while this component is on any gameobject/prefab.
I tried deactivating them in the Editor. This didn’t make any difference.
I also wrote a Script that was supposed to remove these components at the start.
void Start ()
{
#if UNITY_WEBGL
Destroy(GetComponent<NetworkView>());
#endif
}
This was the resulting error
Assets/WebGLManager.cs(14,9): error CS0246: The type or namespace name `NetworkView’ could not be found. Are you missing a using directive or an assembly reference?
Is there a method to exclude a component in general (or NetworkView in this particular case) from a specific build so that I don’t have to delete these components manually everytime I want to do a WebGL build?