Closed Shillersan closed 1 year ago
creating own thread is not recommended and unstable, if you need a loop, please try use callback example in readme.md why you even need own thread? do you looking for a update function?
creating own thread is not recommended and unstable, if you need a loop, please try use callback example in readme.md why you even need own thread? do you looking for a update function?
I tried to use the callback but it was impacting the game's framerate significantly, and another reason is rather than every frame, I needed the method to execute once per second at most. The thread method was working fine at the first glance, but as you said it is kinda unstable and I couldn't think of a good way to shut it down gracefully before game exit.
~snip~
if you wanna execute your code in Update per second, you can literally go google for how does c# dev doing that. like you feel same experience as developing in unity, let me find you example with search in google with 'how to execute function per second in unity update': https://discussions.unity.com/t/how-to-call-a-function-every-second/169748 best way for you is using Time.deltaTime
~snip~
if you wanna execute your code in Update per second, you can literally go google for how does c# dev doing that. like you feel same experience as developing in unity, let me find you example with search in google with 'how to execute function per second in unity update': https://discussions.unity.com/t/how-to-call-a-function-every-second/169748 best way for you is using Time.deltaTime
Ok this makes sense, sorry for my ignorance but I wonder, is there a way to execute function without impacting the framerate? Like running async, but without going out of main thread.
Edit: After doing some research I believe there isn't, best way would be to optimize what I am doing and using just the Update callback.
i think you are looking for this: https://github.com/sneakyevil/IL2CPP_Resolver/issues/30
I create a thread like this:
IL2CPP::Thread::Create(&Update);
then when I close the game, deadlock happens. I tried to using a variable instead oftrue
and signalling the function to break on shutdown, didn't work.