Hello,
When I press button many time, showing error.
I think problem is JSON.stringify(), How can I fix it?
Error
Build.framework.js:1766 An abnormal situation has occurred: the PlayerLoop internal function has been called recursively. Please contact Customer Support with a sample project so that we can reproduce the problem and troubleshoot it.
My source code
GameManager.cs
public class GameManager : MonoBehaviour
{
[SerializeField] TextMeshProUGUI resultText;
[DllImport("__Internal")]
private static extern string testFunc();
public void OnClickGetButton()
{
string resultStr = testFunc();
}
}
*.jslib
mergeInto(LibraryManager.library, {
testFunc : function() {
var obj = {
name: "Bryan",
age: 33
};
var result = JSON.stringify(obj);
var bufferSize = lengthBytesUTF8(result) + 1;
var buffer = _malloc(result);
stringToUTF8(result, buffer, bufferSize);
}
});
Hello, I’m receiving an error: “An abnormal situation has occurred: the PlayerLoop internal function has been called recursively. Please contact Customer Support with a sample project so that we can reproduce the problem and troubleshoot it.” . I’ve literally tried just about everything but it doesn’t seem to be working.
I’m using an auth for my game, so when you load you need to register an account, this way your stats save… however if I run it in Unity, I can function it 100%, however when I build/run (both local and on my site: https://networkingsgamelounge.xyz) I am unable to login at all… whenever I press “login” it just stops basically.
I tried to remove the auth login page to see if the game would work without it… and it does, but I’m still getting that error so I think maybe that error is causing the auth not to work properly or? … if anyone could assist me, I’d greatly appreciated it, thanks.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using UnityEngine.SceneManagement;
public class MainPanel : MonoBehaviour
{
public GameObject ConnectingPanel;
public TMP_InputField nameInput;
public TextMeshProUGUI welcomeTest;
// Start is called before the first frame update
void Start()
{
welcomeTest.text = "Welcome " + PlayerPrefs.GetString("DisplayName");
ConnectingPanel.SetActive(false);
}
// Update is called once per frame
void Update()
{
}
public void NeonCity()
{
ConnectingPanel.SetActive(true);
SceneManager.LoadScene(4);
Time.timeScale = 1;
}
public void VKing()
{
ConnectingPanel.SetActive(true);
SceneManager.LoadScene(5);
Time.timeScale = 1;
}
public void MarketPlace()
{
ConnectingPanel.SetActive(true);
SceneManager.LoadScene(6);
Time.timeScale = 1;
}
public void SwitchScene()
{
//ConnectingPanel.SetActive(true);
SceneManager.LoadScene(2);
Time.timeScale = 1;
}
public void Login()
{
//ConnectingPanel.SetActive(true);
PlayerPrefs.SetString("DisplayName", nameInput.text);
SceneManager.LoadScene(1);
Time.timeScale = 1;
}
}
CharacterSelection.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class CharacterSelection : MonoBehaviour
{
public GameObject[] characters;
public int selectedCharacter = 0;
public GameObject connecting;
void Awake ()
{
connecting.SetActive(false);
characters[selectedCharacter].SetActive(true);
}
public void NextCharacter()
{
characters[selectedCharacter].SetActive(false);
selectedCharacter = (selectedCharacter + 1) % characters.Length;
characters[selectedCharacter].SetActive(true);
}
public void PreviousCharacter()
{
characters[selectedCharacter].SetActive(false);
selectedCharacter--;
if (selectedCharacter < 0)
{
selectedCharacter += characters.Length;
}
characters[selectedCharacter].SetActive(true);
}
public void StartGame()
{
connecting.SetActive(true);
PlayerPrefs.SetInt("selectedCharacter", selectedCharacter);
SceneManager.LoadScene(3, LoadSceneMode.Single);
}
}
LoadCharacter.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class LoadCharacter : MonoBehaviour
{
public GameObject[] characterPrefabs;
public Transform spawnPoint;
public TMP_Text leable;
public GameObject ScenePanel;
void Start()
{
ScenePanel.SetActive(false);
Time.timeScale = 1;
int selectedCharacter = PlayerPrefs.GetInt("selectedCharacter");
GameObject prefab = characterPrefabs[selectedCharacter];
GameObject clone = Instantiate(prefab, spawnPoint.position, Quaternion.identity);
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
}
private void Update() {
{
if (Input.GetKeyDown(KeyCode.Escape))
{
ScenePanel.SetActive(true);
Time.timeScale = 0;
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}
}
public void DisablePanel()
{
ScenePanel.SetActive(false);
Time.timeScale = 1;
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
}