Skip to content

Instantly share code, notes, and snippets.

@mtrive mtrive/EnableThreads.cs
Last active Oct 9, 2019

Embed
What would you like to do?
Unity Editor script to enable WebAssembly multithreading
using UnityEditor;
using UnityEngine;
[InitializeOnLoad]
class EnableThreads
{
static EnableThreads()
{
PlayerSettings.WebGL.linkerTarget = WebGLLinkerTarget.Wasm;
PlayerSettings.WebGL.threadsSupport = true;
PlayerSettings.WebGL.memorySize = 512;
}
}
@ejordan1

This comment has been minimized.

Copy link

ejordan1 commented Oct 9, 2019

I get a bunch of errors:
Assets/Scripts/EnableThreads.cs(5,2): error CS0246: The type or namespace name 'InitializeOnLoadAttribute' could not be found (are you missing a using directive or an assembly reference?)

'EnableThreads' is missing the class attribute 'ExtensionOfNativeClass'!

Please help!

ANSWER: Put it in a folder called "Editor" Thank you.!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.