Skip to content

Instantly share code, notes, and snippets.

@PopupAsylum
Created December 20, 2016 15:00
Show Gist options
  • Save PopupAsylum/a15b3f767b7e767480352640ac2a4998 to your computer and use it in GitHub Desktop.
Save PopupAsylum/a15b3f767b7e767480352640ac2a4998 to your computer and use it in GitHub Desktop.
PointerCursor.jslib goes in Assets/Plugins/WebGL, PointerCursor.cs goes in your scripts folder, call SetPointer(true) to set the cursor as a pointer
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class PointerCursor : MonoBehaviour {
[DllImport("__Internal")]
public static extern void SetPointer(bool arg);
}
var PointerCursor = {
SetPointer: function(arg)
{
document.getElementById("canvas").style.cursor = arg ? "pointer" : "default";
console.log("Set Cursor");
}
};
mergeInto(LibraryManager.library, PointerCursor);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment