Optimization suggestion: Delay the initialization of Python Scripting until it is first called

Currently, every time the code is modified or entering Play Mode, Python Scripting is re-initialized, which significantly slows down the responsiveness of the Editor.

Can we delay the initialization of Python Scripting until it is first called?

(Additionally, Visual Scripting also has this issue.)

We encountered the same issue that make Python less practical during development. Can we have an option to disable this initialization process for each code compilation?

[SOLVED] I have reviewed the code for PythonRunner version 7.0.1 and found that you can simply comment out the PythonRunner.InitializeOnLoad method. It has already implemented initialization checking internally, so if it is called before initialization, it will automatically call the initialize method.

After making the aforementioned modifications, the Editor may become unresponsive for a few seconds when executing Python code for the first time. Therefore, I have added a progress bar to provide a visual indication.

Throw that ClearProgressBar into a finally, then you don’t have to repeat it twice :stuck_out_tongue:

1 Like