A method for speeding up Unity project opening speed

CN117632207BActive Publication Date: 2026-09-22XIAMEN WOOBEST INTERACTIVE NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311653484.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-05
Publication Date
2026-09-22
Estimated Expiration
2043-12-05

AI Technical Summary

Technical Problem

[0003]为解决上述问题,本发明提供了一种加快Unity项目打开速度的方法,旨在解决Unity打开工程时,由于更新项目文件不及时,更新后需要重新加载新增的代码和资源,导致项目打开缓慢,影响开发效率的问题

Benefits of technology

[0033]采用上述技术方案后,本发明与背景技术相比,具有如下优点:本发明自定义指定时间或者电脑空闲指定时间时更新指定的项目,并自动预加载好代码和资源,降低进入Unity的等待时间,可提高开发效率;通过项目版本标识可以同时设置多个项目的多个版本进行自动更新和预加载资源;定期在指定时间自动执行指定版本SVN或者GIT的更新操作,保证项目资源始终是较新的状态;更新后自动加载新增的代码和资源,大大缩短进入Unity的时间;在电脑空闲时进行更新,保证项目资源随时都是较新的状态。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117632207B_ABST
    Figure CN117632207B_ABST
Patent Text Reader

Abstract

The application discloses a method for accelerating the opening speed of a Unity project, and comprises the following steps: S1, a C# script LoadRes is newly created in Unity to realize resource loading; S2, the command for loading resources in Unity is encapsulated by Batch batch processing to perform the loading operation of project resources; S3, the updating instruction of SVN or GIT is encapsulated by Batch batch processing, and after the updating is completed, the resource loading is performed; S4, a Batch script program start_auto_update.bat is written and placed under the Unity project to realize the starting automatic updating operation; S5, a Batch script program stop_auto_update.bat is written and placed under the Unity project to realize the stopping automatic updating operation; S6, an editor menu and an editor window are created in Unity, and the starting or stopping automatic updating plan is realized by clicking; the application updates the specified project at the specified time or the specified time when the computer is idle, and automatically preloads the code and resources, so that the waiting time for entering Unity is reduced, and the development efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of game technology, and in particular to a method for speeding up the opening speed of Unity projects. Background Technology

[0002] In actual project development, developing multiple versions (int, patch, release) of the same project is very common, which involves switching between multiple projects. However, a certain version may not have been updated for a long time, during which time a lot of code or resources may have been added. When you need to open this version, update SVN or Git, and then open Unity to load these code and resources, it can take a long time, which is very inefficient. If you encounter a critical problem, the wasted time can cause serious losses. Although there are some automatic update solutions, they only update project files and are not integrated with Unity tools. They do not preload newly added files, so when you open Unity, you still need to reload the code and resources, which takes a lot of time. Moreover, they do not support updating during idle time, so they are not flexible and the efficiency improvement is limited, making it difficult to meet actual usage needs. Summary of the Invention

[0003] To address the aforementioned issues, this invention provides a method for accelerating the opening speed of Unity projects. The aim is to resolve the problem that when opening a Unity project, the slow opening speed and impact on development efficiency are caused by untimely updates to project files, requiring reloading of newly added code and resources after updates.

[0004] The present invention adopts the following technical solution:

[0005] One method to speed up the opening of Unity projects includes the following steps:

[0006] S1. Create a new C# script named LoadRes in Unity to load resources;

[0007] S2. Encapsulate Unity's resource loading commands using Batch processing to perform project resource loading operations;

[0008] S3. Encapsulate the SVN or GIT update commands into a batch process, and load the resources after the update is complete;

[0009] S4. Write a batch script program start_auto_update.bat and place it in the Unity project to implement the automatic update operation.

[0010] S5. Write a batch script program stop_auto_update.bat and place it in the Unity project to stop the automatic update operation;

[0011] S6. Create an editor menu and editor window in Unity, and start or stop the automatic update schedule by clicking.

[0012] Preferably, the C# script LoadRes in step S1 contains a static function RefreshData, which calls UnityAssetDatabase.Refresh() to load resources.

[0013] Preferably, step S2 includes the following steps:

[0014] S21. Encapsulate Unity's resource loading commands using Batch processing;

[0015] S22. Call it via load_res.bat. Calling load_res.bat requires passing two parameters: the project directory and the path to Unity.exe.

[0016] S23. In the load_res.bat script, use the Unity command Unity.exe-batchmode-quit-projectPath%PROJECT_CLIENT_PATH%-executeMet hodXXX to load project resources, where XXX calls the RefreshData static function in step S1.

[0017] Preferably, step S3 includes the following steps:

[0018] S31. Encapsulate SVN or GIT update commands using Batch processing;

[0019] S32. Call via update.bat. When calling update.bat, you need to pass the project directory as a parameter:

[0020] S33. In the update.bat script, first call the SVN or GIT update command to perform the update. After the update is completed, call load_res.bat in step S22 to load the resources.

[0021] Preferably, step S4 includes the following steps:

[0022] S41. Write a batch script program start_auto_update.bat and place it in the Unity project. The batch script program receives three parameters: the path of Unity.exe, whether to enable idle update, and the idle time interval.

[0023] S42. Use the command schtasks / create to create a Windows task. The task name is the keyword of the project version. The task will be triggered randomly between 4:00 AM and 6:00 AM every day. When triggered, the update.bat script in step S32 will be executed and the project directory and Unity directory will be passed in as parameters. The keyword includes int, patch and release.

[0024] S43. If idle update is enabled, use the schtasks / create command to create a Windows task. The task is triggered when the computer is idle and there is no input. When triggered, the update.bat script in step S32 is executed and the project directory and Unity directory are passed in as parameters.

[0025] Preferably, step S5 includes the following steps:

[0026] S51. Write a batch script program stop_auto_update.bat and place it in the Unity project;

[0027] S52. In the stop_auto_update.bat script, automatically obtain the current project path and extract keywords to distinguish different projects; wherein, the keywords include int, patch, and release;

[0028] S53. Execute the Windows command schtasks / delete to delete the two Windows tasks created in steps S42 and S43, thereby stopping the automatic update operation.

[0029] Preferably, step S6 includes the following steps:

[0030] S61. In Unity, create an editor menu for setting automatic project updates and an editor window for automatic update settings. Open the editor window by clicking the editor menu. The editor window provides an option to enable or disable idle time updates and an input box for specifying idle time. The editor window also provides a start automatic update plan button and a stop automatic update plan button.

[0031] S62. Click the "Start Automatic Update Schedule" button, obtain the directory of Unity.exe through Unity API EditorApplication.applicationPath, obtain the project directory through C# API Environment.CurrentDirectory, and then call the start_auto_update.bat script to start the Windows automatic update task;

[0032] S63. Click the "Stop Automatic Updates" button to execute the stop_auto_update.bat script and stop the Windows automatic update task.

[0033] By adopting the above technical solution, the present invention has the following advantages compared with the prior art: The present invention updates a specified project at a custom specified time or when the computer is idle, and automatically preloads the code and resources, reducing the waiting time to enter Unity and improving development efficiency; multiple versions of multiple projects can be set simultaneously for automatic updates and resource preloading through project version identifiers; the specified version of SVN or GIT update operation is automatically executed at a specified time on a regular basis to ensure that project resources are always in the latest state; newly added code and resources are automatically loaded after the update, greatly shortening the time to enter Unity; and updates are performed when the computer is idle to ensure that project resources are always in the latest state. Attached Figure Description

[0034] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

[0035] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0036] Example

[0037] like Figure 1 As shown, a method to speed up the opening speed of Unity projects includes the following steps:

[0038] S1. Create a new C# script named LoadRes in Unity to load resources;

[0039] The C# script LoadRes mentioned in step S1 contains a static function RefreshData, which calls UnityAssetDatabase.Refresh() to load resources.

[0040] S2. Encapsulate Unity's resource loading commands using Batch processing to perform project resource loading operations;

[0041] Step S2 includes the following steps:

[0042] S21. Encapsulate Unity's resource loading commands using Batch processing;

[0043] S22. Call it via load_res.bat. Calling load_res.bat requires passing two parameters: the project directory and the path to Unity.exe.

[0044] S23. In the load_res.bat script, use the Unity command Unity.exe-batchmode-quit-projectPath%PROJECT_CLIENT_PATH%-executeMet hod XXX to load project resources, where XXX calls the RefreshData static function in step S1;

[0045] S3. Encapsulate the SVN or GIT update commands into a batch process, and load the resources after the update is complete;

[0046] Step S3 includes the following steps:

[0047] S31. Encapsulate SVN or GIT update commands using Batch processing;

[0048] S32. Call via update.bat. When calling update.bat, you need to pass the project directory as a parameter:

[0049] S33. In the update.bat script, first call the SVN or GIT update command to perform the update. After the update is completed, call load_res.bat in step S22 to load the resources.

[0050] S4. Write a batch script program start_auto_update.bat and place it in the Unity project to implement the automatic update operation.

[0051] Step S4 includes the following steps:

[0052] S41. Write a batch script program start_auto_update.bat and place it in the Unity project. The batch script program receives three parameters: the path of Unity.exe, whether to enable idle update, and the idle time interval.

[0053] S42. Use the command schtasks / create to create a Windows task. The task name is the keyword of the project version. The task will be triggered randomly between 4:00 AM and 6:00 AM every day. When triggered, the update.bat script in step S32 will be executed and the project directory and Unity directory will be passed in as parameters. The keyword includes int, patch and release.

[0054] S43. If idle update is enabled, use the schtasks / create command to create a Windows task. The task is triggered when the computer is idle and there is no input. When triggered, the update.bat script in step S32 is executed and the project directory and Unity directory are passed in as parameters.

[0055] S5. Write a batch script program stop_auto_update.bat and place it in the Unity project to stop the automatic update operation;

[0056] Step S5 includes the following steps:

[0057] S51. Write a batch script program stop_auto_update.bat and place it in the Unity project;

[0058] S52. In the stop_auto_update.bat script, automatically obtain the current project path and extract keywords to distinguish different projects; wherein, the keywords include int, patch, and release;

[0059] S53. Execute the Windows command schtasks / delete to delete the two Windows tasks created in steps S42 and S43, thereby stopping the automatic update operation;

[0060] S6. Create an editor menu and editor window in Unity, and start or stop the automatic update schedule by clicking;

[0061] Step S6 includes the following steps:

[0062] S61. In Unity, create an editor menu for setting automatic project updates and an editor window for automatic update settings. Open the editor window by clicking the editor menu. The editor window provides an option to enable or disable idle time updates and an input box for specifying idle time. The editor window also provides a start automatic update plan button and a stop automatic update plan button.

[0063] S62. Click the "Start Automatic Update Schedule" button, obtain the directory of Unity.exe through Unity API EditorApplication.applicationPath, obtain the project directory through C# API Environment.CurrentDirectory, and then call the start_auto_update.bat script to start the Windows automatic update task;

[0064] S63. Click the "Stop Automatic Updates" button to execute the stop_auto_update.bat script and stop the Windows automatic update task.

[0065] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for accelerating the opening speed of Unity projects, characterized in that: Includes the following steps: S1. Create a new C# script named LoadRes in Unity to load resources; S2. Encapsulate Unity's resource loading commands using Batch processing to perform project resource loading operations; S3. Encapsulate the SVN or GIT update commands into a batch process, and load the resources after the update is complete; S4. Write a batch script program start_auto_update.bat and place it in the Unity project to implement the automatic update operation. Step S4 includes the following steps: S41. Write a batch script program start_auto_update.bat and place it in the Unity project. The batch script program receives three parameters: the path of Unity.exe, whether to enable idle update, and the idle time interval. S42. Use the command schtasks / create to create a Windows task. The task name is the keyword of the project version. The task will be triggered randomly between 4:00 AM and 6:00 AM every day. When triggered, the update.bat script in step S32 will be executed and the project directory and Unity directory will be passed in as parameters. The keyword includes int, patch and release. S43. If idle update is enabled, use the schtasks / create command to create a Windows task. The task is triggered when the computer is idle and there is no input. When triggered, the update.bat script in step S32 is executed and the project directory and Unity directory are passed in as parameters. S5. Write a batch script program stop_auto_update.bat and place it in the Unity project to stop the automatic update operation; S6. Create an editor menu and editor window in Unity, and start or stop the automatic update schedule by clicking.

2. The method for accelerating the opening speed of Unity projects as described in claim 1, characterized in that: The C# script LoadRes mentioned in step S1 contains a static function RefreshData, which calls UnityAssetDatabase.Refresh() to load resources.

3. The method for accelerating the opening speed of Unity projects as described in claim 2, characterized in that: Step S2 includes the following steps: S21. Encapsulate Unity's resource loading commands using Batch processing; S22. Call it via load_res.bat. Calling load_res.bat requires passing two parameters: the project directory and the path to Unity.exe. S23. In the load_res.bat script, use the Unity command Unity.exe-batchmode-quit-projectPath%PROJECT_CLIENT_PATH%-executeMethod XXX to load project resources. XXX calls the RefreshData static function from step S1.

4. The method for accelerating the opening speed of Unity projects as described in claim 3, characterized in that: Step S3 includes the following steps: S31. Encapsulate SVN or GIT update commands using Batch processing; S32. Call via update.bat. When calling update.bat, you need to pass the project directory as a parameter: S33. In the update.bat script, first call the SVN or GIT update command to perform the update. After the update is completed, call load_res.bat in step S22 to load the resources.

5. The method for accelerating the opening speed of Unity projects as described in claim 4, characterized in that: Step S5 includes the following steps: S51. Write a batch script program stop_auto_update.bat and place it in the Unity project; S52. In the stop_auto_update.bat script, obtain the current project path and the keywords therein to distinguish different projects; wherein, the keywords include int, patch, and release; S53. Execute the Windows command schtasks / delete to delete the two Windows tasks created in steps S42 and S43, thereby stopping the automatic update operation.

6. The method for accelerating the opening speed of Unity projects as described in claim 5, characterized in that: Step S6 includes the following steps: S61. In Unity, create an editor menu for setting automatic project updates and an editor window for automatic update settings. Open the editor window by clicking the editor menu. The editor window provides an option to enable or disable idle time updates and an input box for specifying idle time. The editor window also provides a start automatic update plan button and a stop automatic update plan button. S62. Click the Start Automatic Update Schedule button, obtain the directory of Unity.exe through Unity API EditorApplication.applicationPath, obtain the project directory through C# API Environment.CurrentDirectory, and then call the start_auto_update.bat script to start the Windows automatic update task; S63. Click the "Stop Automatic Updates" button to execute the stop_auto_update.bat script and stop the Windows automatic update task.