| Current Path : /var/www/html/unity/characters-18082024/ |
| Current File : /var/www/html/unity/characters-18082024/index.html |
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | Pilih Karakter Anda</title>
<script src="Build/UnityLoader.js"></script>
<script>
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/characters-18082024.json");
</script>
<script>
window.alert = function(message) {
// Prevent the alert popup from appearing
console.log('Alert suppressed:', message);
};
// Function to get URL parameters
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}
// Function to send parameters to Unity
function sendParametersToUnity() {
var userId = getUrlParameter('userid');
if (userId) {
// Delay the message until Unity is fully initialized
if (typeof gameInstance !== 'undefined' && gameInstance.SendMessage) {
gameInstance.SendMessage('URLParameterManager', 'ReceiveParameter', userId);
setTimeout(sendParametersToUnity, 10000);
} else {
// Retry after a short delay
setTimeout(sendParametersToUnity, 10000);
}
}
}
</script>
</head>
<body style="width: 100vw; height: 100vh; margin: auto" onload="sendParametersToUnity()">
<div id="gameContainer" style="width: 100vw; height: 100vh; margin: auto;"></div>
</body>
</html>