![]() Private void threadExecution(float starttime, float waitingtime) The threading method have to return void I think Thread parallelThread = new Thread(() => threadExecution(0.0f, 0.1f)) I will look something like this (might be errors) I just tried it out in another plugin I have, where I use a coroutine to listens for an animation to finish before implementing the manipulations of the partModule, and it seems to work fine, even if I am aggressive in my execution of it. I'm thinking throwing a coroutine the continuously listens for the throttle in the parallel thread. In the meantime, I did some research and think I can implement this as a separate thread running in parallel with the main one for KSP/Unity. I really get your point, and hope Squad will implement a stock event I can subscribe to. The overhead of checking all the time in update (main processing thread) bother me. It's been a few KSP versions since I tested that, but it is since KSP 1.0 or newer so I have no reason to think its changed. So any changes made to on the focus vessel don't take as the value in overwrites it. However, the throttle UI object seen on screen is and the seems to get slaved to this for the focus vessel. ![]() A coroutine that checks once every 5 seconds would probably be lower overhead, but I don't know how long a delay would be required for the coroutine to be less overhead then just checking every frame.Īs for the two throttle objects, every vessel (including focus vessel) have a. Keep in mind that you have to run background logic of some sort to check the throttle to either throw an event or check in a coroutine anyway and I would lay odds that either of those would just be checking current throttle against a saved value anyway. What is the difference between these two? Is it that the bottom one would fire for all loaded vessels if I do this in a parts module, while the top one would only fire for the specific vessel? (now I would be happy if I knew how to create and independent tread to run this process in - taking the load of the main tread) Would a coroutine be better for performance? Or would the overhead of having the coroutine runnning be worse than just doing as Diazo is suggesting and just checking the throttlestate every frame? ![]() Ok, I've been avoiding using onUpdate() and onFixedUpdate() because I really do not want to end up with a mod that is hitting performance.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |