Skip to content

Commit

Permalink
testing if this fixed the auto build
Browse files Browse the repository at this point in the history
  • Loading branch information
bozmir committed Jan 7, 2025
1 parent 9ade52b commit 7f0c641
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Assets/Plugins/LockCursor.jslib
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
mergeInto(LibraryManager.library, {
AutoCursorLock: function () {
window.OnCursorStateChanged = function OnCursorStateChanged()
{
var unityCanvas = document.getElementById("unity-canvas");
if (document.pointerLockElement != unityCanvas && document.mozPointerLockElement != unityCanvas) {
unityInstance.SendMessage("CameraModeChanger", "GodViewMode");
}
}
//Cursor locking for First Person camera mode
if ("onpointerlockchange" in document) {
document.addEventListener('pointerlockchange', window.OnCursorStateChanged, false);
console.log(document.pointerLockElement);
}
else if ("onmozpointerlockchange" in document) {
document.addEventListener('mozpointerlockchange', window.OnCursorStateChanged, false);
console.log(document.mozPointerLockElement);
}
},
/*
This method locks the cursor for you, since sometimes doing it through Unity just doesn't work
*/
LockCursorInternal: function () {
document.getElementById("unity-canvas").requestPointerLock();
}
});
32 changes: 32 additions & 0 deletions Assets/Plugins/LockCursor.jslib.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Assets/Plugins/MobileDetection.jslib
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mergeInto(LibraryManager.library, {
isMobile: function() {
return /(iPhone|iPod|iPad|Android|BlackBerry|Windows Phone)/i.test(navigator.userAgent);
}
});
32 changes: 32 additions & 0 deletions Assets/Plugins/MobileDetection.jslib.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7f0c641

Please sign in to comment.