Closed HajiyevEl closed 11 months ago
You can't use new for MonoBehaviours in Unity. If you're trying to use this in editor code, then unfortunately you cannot. You don't need it in editor code, you can use a .NET ClientWebSocket directly.
I would need to see sample code to help more. Please post the entire file of your code. I will close this in a few hours, otherwise. Thanks!
You can't use new for MonoBehaviours in Unity. If you're trying to use this in editor code, then unfortunately you cannot. You don't need it in editor code, you can use a .NET ClientWebSocket directly.
I would need to see sample code to help more. Please post the entire file of your code. I will close this in a few hours, otherwise. Thanks!
Thank you for answer! Sorry, i didn't have time yesterday so couldn't reply promptly. Actually, after some testing i found out that it's not just instantiating, i could not even add WebSocketConnection script to any gameobject in the scene without it freezing entire app on entering play mode. I created new project, but all was good there. I don't know what changed in my main project, but now i can't use WebSocketConnection script in any way from there (instantiating, adding WSCon component from script etc..) By the way, tried deleting Liblary folder, but it didn't help.
Hello. I am interested in helping, but I still need to see your code. If you don't want to post it, then my recommendation would be to start removing things from your main project until it looks more like your new project since that one is working. You can also check the unity version and see if that's different.
I will close this now since you've gotten it working in a new project. If you find that there is still a problem with this library, then please file a new issue with a specific description of the problem you found, or with repro steps. Unfortunately, it's not feasible for me to help without more specifics. Thanks!
So... Instantiating prefab (Unity) with WebSocketConnection script freezes application. Can't create class instance with new() expression due to it being monobehaviour. Any ideas?