CN112199126A - Dynamic loading method and device based on Unity engine and computer equipment - Google Patents

Dynamic loading method and device based on Unity engine and computer equipment Download PDF

Info

Publication number
CN112199126A
CN112199126A CN202011022730.3A CN202011022730A CN112199126A CN 112199126 A CN112199126 A CN 112199126A CN 202011022730 A CN202011022730 A CN 202011022730A CN 112199126 A CN112199126 A CN 112199126A
Authority
CN
China
Prior art keywords
model
unity
hard disk
plug
texture
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011022730.3A
Other languages
Chinese (zh)
Inventor
李劼
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Datamesh Technology Co ltd
Original Assignee
Beijing Datamesh Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Datamesh Technology Co ltd filed Critical Beijing Datamesh Technology Co ltd
Priority to CN202011022730.3A priority Critical patent/CN112199126A/en
Publication of CN112199126A publication Critical patent/CN112199126A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Image Generation (AREA)

Abstract

The invention discloses a dynamic loading method and device based on a Unity engine and computer equipment. Wherein the method comprises the following steps: uploading the 3D model to a cloud end, transmitting the 3D model to a preset 3D model processor after the cloud end receives the 3D model, starting a game engine Unity on the 3D model processor through the cloud end, opening a 3D model processing program of the 3D model processor, reading the 3D model by the 3D model processing program by using a plug-in, storing the 3D model read by using the plug-in a memory, storing the 3D model read by using the plug-in on a hard disk to form a resource available for Unity, converting the 3D model stored in the hard disk into a series of dynamically loadable resources AssetBundle by using a tool based on a Unity engine, the resources are associated with each platform, each platform corresponds to one resource, a user can dynamically load the 3D model on various platforms, and the requirement that the user introduces the 3D model and uses the model on various platforms can be met.

Description

Dynamic loading method and device based on Unity engine and computer equipment
Technical Field
The invention relates to the technical field of Unity, in particular to a dynamic loading method and device based on a Unity engine and computer equipment.
Background
In recent years, the Unity3D (three-dimensional game engine) engine is more and more widely used, and the good expandability and cross-platform performance thereof enable the application development of many industries to be more convenient.
However, Unity3D was originally designed as a game engine, so most of its processes are designed for game development, and especially the management of 3D model assets is only used in the manner of pre-importing engineering, and cannot dynamically load 3D models at runtime. For games, resources are preset, so that the problem is not too great, but for other industrial applications such as industry, some problems such as various 3D model formats are encountered, and Unity3D can only import limited 3D models, for example, a 3D model often needs to be put in by a user and cannot be preset in a Unity3D project.
Therefore, we can only use the Unity3D plug-in made by a third party to extend the 3D model loading capability, however, loading a 3D model at runtime is very performance-consuming, and for a large 3D model, it often takes several minutes or even longer to load one 3D model; more troubling, dynamically loading a 3D model consumes a lot of memory, runs on a platform with relatively weak performance, and often causes a problem of program crash due to memory exceeding the limit.
On the other hand, Unity3D provides a storage format allowing dynamic loading, which is called an AssetBundle (dynamically loadable resource), and can make resources such as a 3D model into the AssetBundle, and the resources can be loaded at runtime, so that the speed is high and the occupied resources are small. However, the AssetBundle can only be manufactured by pre-importing static resources of a project, and the 3D model loaded by the Unity3D plug-in manufactured by a third party cannot be manufactured by the AssetBundle, so that a user cannot dynamically load the 3D model on various platforms by himself or herself, and the requirements of the user on importing the 3D model and using the 3D model on various platforms by himself or herself cannot be met.
Disclosure of Invention
In view of this, the present invention provides a dynamic loading method, apparatus, and computer device based on a Unity engine, which can enable a user to dynamically load a 3D model on various platforms by himself, and can meet the requirement that the user introduces the 3D model and uses the model on various platforms by himself.
According to an aspect of the invention, a dynamic loading method based on a Unity engine is provided, which comprises the following steps: uploading the 3D model to a cloud; after the cloud receives the 3D model, transmitting the 3D model to a preset 3D model processor; starting a game engine Unity on the 3D model processor in a remote calling mode through the cloud, and opening a 3D model processing program of the 3D model processor; reading, by the 3D model handler, the 3D model using a plug-in; storing the 3D model read by the plug-in into a memory, wherein the 3D model read by the plug-in is required to be stored on a hard disk to form a Unity available resource; the 3D model stored on the hard disk is converted into a series of dynamically loadable resources, assetBundle, by using a Unity engine-based tool, wherein the resources are platform-related, and each platform corresponds to one resource.
Wherein, storing the 3D model read by using the plug-in the memory, and storing the 3D model read by using the plug-in to a hard disk to form a Unity available resource includes: creating a Unity preset file as a storage main body of the 3D model read by the plug-in; storing all the associated textures in the 3D model read by using the plug-in to a hard disk and generating a mapping table of the associated textures stored in the hard disk; reading all the material information contained in the 3D model read by using the plug-in, and replacing all the texture information contained in the read material information with newly-built texture information according to the generated mapping table of the associated texture; storing all the read material information into a hard disk, wherein one piece of material information corresponds to one material file; and storing the main body information of the 3D model read by using the plug-in the created preset file to form a resource available for Unity.
Wherein the storing all the associated textures in the 3D model read by using the plug-in to the hard disk and generating the mapping table of the associated textures existing to the hard disk includes: loading all the associated textures in the 3D model read by the plug-in into a memory; and creating a new texture corresponding to the size of the associated texture loaded into memory; and drawing the content of the associated texture loaded into the memory to the new texture; compressing the new textures according to a preset format and storing the new textures in a hard disk, wherein each texture of the new textures corresponds to an image file in the preset format; recording the mapping table of the associated texture loaded into the memory and the new texture; and the mapping table is used for modifying the texture mapping relation in the associated material file.
Wherein, the 3D model stored on the hard disk is converted into a series of dynamically loadable resources AssetBundle by a Unity engine-based tool, the resources are platform-related, and each platform corresponds to one resource, including: according to the complexity of the Unity resource stored in the hard disk and the scale of the associated resource, calling a corresponding interface of Unity by adopting a format conversion mode for the Unity resource stored in the hard disk, and converting the 3D model stored in the hard disk into a series of dynamically loadable resources, AssetBundle, by using a Unity engine-based tool, wherein the resources are platform-associated and each platform corresponds to one resource.
Wherein, after the 3D model stored on the hard disk is converted into a series of dynamically loadable resources AssetBundle by the Unity engine-based tool, the resources are platform-related, and each platform corresponds to one resource, the method further comprises: and collecting and recording file information of the dynamically loadable resource AssetBundle associated with each generated platform through the cloud.
According to another aspect of the present invention, there is provided a Unity engine based dynamic loading apparatus, comprising: the device comprises an uploading module, a transmission module, a starting module, a reading module, a storage module and a conversion module; the uploading module is used for uploading the 3D model to a cloud end; the transmission module is used for transmitting the 3D model to a preset 3D model processor after the cloud receives the 3D model; the starting module is used for starting a game engine Unity on the 3D model processor in a remote calling mode through the cloud end and opening a 3D model processing program of the 3D model processor; the reading module is used for reading the 3D model by using a plug-in through the 3D model processing program; the storage module is used for storing the 3D model read by the plug-in into a memory, and the 3D model read by the plug-in is required to be stored on a hard disk to form a Unity available resource; the conversion module is used for converting the 3D model stored on the hard disk into a series of dynamically loadable resources, AssetBundle, by using a Unity engine-based tool, wherein the resources are associated with platforms, and each platform corresponds to one resource.
The storage module is specifically configured to: creating a preset file of Unity as a storage main body of the 3D model read by the plug-in; storing all the associated textures in the 3D model read by using the plug-in to a hard disk and generating a mapping table of the associated textures stored in the hard disk; reading all the material information contained in the 3D model read by using the plug-in, and replacing all the texture information contained in the read material information with newly-built texture information according to the generated mapping table of the associated texture; storing all the read material information into a hard disk, wherein one piece of material information corresponds to one material file; and storing the main body information of the 3D model read by using the plug-in the created preset file to form a resource available for Unity.
The storage module is specifically configured to: loading all the associated textures in the 3D model read by the plug-in into a memory; and creating a new texture corresponding to the size of the associated texture loaded into memory; and drawing the content of the associated texture loaded into the memory to the new texture; compressing the new textures according to a preset format and storing the new textures in a hard disk, wherein each texture of the new textures corresponds to an image file in the preset format; recording the mapping table of the associated texture loaded into the memory and the new texture; and the mapping table is used for modifying the texture mapping relation in the associated material file.
Wherein, the conversion module is specifically used for: according to the complexity of the Unity resource stored in the hard disk and the scale of the associated resource, calling a corresponding interface of Unity by adopting a format conversion mode for the Unity resource stored in the hard disk, and converting the 3D model stored in the hard disk into a series of dynamically loadable resources, AssetBundle, by using a Unity engine-based tool, wherein the resources are platform-associated and each platform corresponds to one resource.
The dynamic loading device based on the Unity engine further comprises: a collection module; and the collection module is used for collecting and recording file information of the dynamically loadable resource AssetBundle associated with each generated platform through the cloud.
According to yet another aspect of the present invention, there is provided a computer apparatus comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a Unity engine based dynamic loading method as claimed in any preceding claim.
According to yet another aspect of the present invention, there is provided a computer readable storage medium storing a computer program which, when executed by a processor, implements the Unity engine based dynamic loading method as described in any of the above.
It can be found that, in the above solution, the 3D model can be uploaded to the cloud, and the 3D model can be transmitted to the preset 3D model handler after the 3D model is received by the cloud, and the game engine Unity on the 3D model handler can be started and the 3D model handler of the 3D model handler can be opened by using the remote call mode through the cloud, and the 3D model can be read by using the plug-in through the 3D model handler, and the 3D model read by using the plug-in can be stored in the memory, it is required to store the 3D model read by using the plug-in on the hard disk first, so as to form a resource available for Unity, and the 3D model stored on the hard disk can be converted into a series of dynamically loadable resources AssetBundle by using a tool based on the Unity engine, such resources are platform-related, each platform corresponds to one resource, wherein one platform corresponds to one dynamically loadable resource AssetBundle, so that a user can dynamically load a 3D model on various platforms by himself, and the requirement that the user introduces the 3D model and uses the model on various platforms by himself can be met.
Further, the above solution may create a Unity default file as a storage main body of the 3D model read by the plug-in, store all associated textures in the 3D model read by the plug-in to a hard disk and generate a mapping table of the associated textures stored in the hard disk, read all material information contained in the 3D model read by the plug-in, replace all texture information contained in all read material information with new texture information according to the generated mapping table of the associated textures, store all read material information to the hard disk, one material information corresponding to one material file, and store the main body information of the 3D model read by the plug-in to the created default file to form a resource available for Unity, which is advantageous in that the created default file can be associated with all material files, the material file can be associated with all the associated texture files in the 3D model read by the plug-in.
Furthermore, the above solution can load all the associated textures in the 3D model read by using the plug-in into the memory, creating a new texture with the same size as the associated texture loaded into the memory, drawing the content of the associated texture loaded into the memory to the new texture, compressing the new texture according to a preset format and storing the new texture to a hard disk, each texture of the new texture corresponds to an image file of the preset format, and a mapping table of the associated texture loaded into the memory and the new texture is recorded, the mapping table is used for modifying the texture mapping relation in the associated material file, and the method has the advantage that all associated textures in the 3D model which cannot be directly stored in the hard disk and is read by the plug-in can be stored in the hard disk.
Further, according to the above scheme, according to the complexity of the Unity resource stored in the hard disk and the scale of the associated resource, the Unity resource stored in the hard disk can be used for calling the corresponding interface of Unity in a format conversion manner to generate the dynamically loadable resource AssetBundle associated with each platform, wherein one platform corresponds to one dynamically loadable resource AssetBundle, so that the advantage that a user can dynamically load a 3D model on various platforms by himself is achieved, and the need that the user can import the 3D model and use the model on various platforms by himself can be met.
Further, according to the scheme, the file information of the dynamically loadable resource AssetBundle which is associated with each platform can be collected and recorded through the cloud, and the advantage that the associated resources of the corresponding platform can be provided when a user uses the file information is achieved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart illustrating an embodiment of a dynamic loading method based on a Unity engine according to the present invention;
FIG. 2 is a flowchart illustrating another embodiment of the dynamic loading method based on the Unity engine according to the present invention;
FIG. 3 is a schematic structural diagram of an embodiment of a Unity engine based dynamic loading apparatus according to the present invention;
FIG. 4 is a schematic structural diagram of another embodiment of the dynamic loading apparatus based on the Unity engine according to the present invention;
FIG. 5 is a schematic structural diagram of an embodiment of the computer apparatus of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be noted that the following examples are only illustrative of the present invention, and do not limit the scope of the present invention. Similarly, the following examples are only some but not all examples of the present invention, and all other examples obtained by those skilled in the art without any inventive work are within the scope of the present invention.
The dynamic loading method based on the Unity engine can realize that a user can dynamically load the 3D model on various platforms by himself, and can meet the requirement that the user can import the 3D model and use the model on various platforms by himself.
Referring to fig. 1, fig. 1 is a flowchart illustrating an embodiment of a Unity engine based dynamic loading method according to the present invention. It should be noted that the method of the present invention is not limited to the flow sequence shown in fig. 1 if the results are substantially the same. As shown in fig. 1, the method comprises the steps of:
s101: and uploading the 3D model to a cloud.
In this embodiment, the 3D model may be uploaded to the cloud through a wireless network, or the 3D model may be uploaded to the cloud through a wired network, and the like.
S102: and after receiving the 3D model at the cloud end, transmitting the 3D model to a preset 3D model processor.
In this embodiment, the 3D model handler may be an independent host installed with a Unity3D environment, or a combined host installed with a Unity3D environment, and the invention is not limited thereto.
S103: and starting a Unity (game engine) on the 3D model processor in a remote calling mode through the cloud, and opening a 3D model processing program of the 3D model processor.
In this embodiment, the Remote Call may be an RPC (Remote procedure Call) mode, an HTTP (HyperText transfer protocol) mode, or the like, which is not limited in the present invention.
S104: the 3D model is read by the 3D model handler using a plug-in.
In this embodiment, the 3D model may be read by the 3D model handler using a TriLib (Unity3D model loader) plug-in, or the 3D model may be read by the 3D model handler using another plug-in, and the invention is not limited thereto.
S105: and storing the 3D model read by the plug-in into a memory, wherein the 3D model read by the plug-in needs to be stored on a hard disk to form a Unity available resource (Asset).
The storing the 3D model read by using the plug-in the memory, which requires storing the 3D model read by using the plug-in to the hard disk to form a Unity available resource, may include:
creating a preset file of Unity, such as prefab file, as a storage body of the 3D model read by using the plug-in;
storing all the associated textures in the 3D model read by the plug-in to a hard disk and generating a mapping table of the associated textures stored in the hard disk;
reading all the material information contained in the 3D model read by using the plug-in, and replacing all the texture information contained in the read material information with newly-built texture information according to the generated mapping table of the associated texture;
storing all the read material information into a hard disk, wherein one piece of material information corresponds to one material file (. mat);
storing the main body information of the 3D model read by the plug-in the created preset file to form a Unity available resource;
this has the advantage that the created default file can be associated with all material files, which in turn can be associated with all associated texture files in the 3D model read using the plug-in.
The storing all the associated textures in the 3D model read by using the plug-in to the hard disk and generating the mapping table of the associated textures stored in the hard disk may include:
loading all the associated textures in the 3D model read by the plug-in into a memory;
and creating a new texture corresponding to the size of the associated texture loaded into memory;
and drawing the content of the associated texture loaded into the memory to the new texture;
compressing the new texture according to a preset format such as png (Portable Network Graphics, Portable Network Graphics format) and storing the new texture in a hard disk, wherein each texture of the new texture corresponds to an image file of the preset format such as png image file;
recording the mapping table of the associated texture loaded into the memory and the new texture; wherein, the mapping table is used for modifying the texture mapping relation in the associated material file;
this has the advantage that all the associated textures in the 3D model read by the plug-in, which cannot be directly stored to the hard disk, can be stored to the hard disk.
S106: the 3D model stored on the hard disk is converted into a series of dynamically loadable resources, assetBundle, by using a Unity engine-based tool, wherein the resources are platform-related, and each platform corresponds to one resource.
The converting, by a Unity engine-based tool, the 3D model stored on the hard disk into a series of dynamically loadable resources AssetBundle, where the resources are platform-related, and each platform corresponds to a resource may include:
according to the complexity of the Unity resource stored in the hard disk and the scale of the associated resource, the Unity resource stored in the hard disk is converted into a corresponding interface of Unity by adopting a format conversion mode, and a 3D model stored on the hard disk is converted into a series of dynamically loadable resources, AssetBundle, by using a Unity engine-based tool, wherein the resources are platform-associated, and each platform corresponds to one resource.
After the 3D model stored on the hard disk is converted into a series of dynamically loadable resources AssetBundle by a Unity engine-based tool, the resources are platform-related, and each platform corresponds to one resource, the method may further include:
the cloud collects and records the file information of the dynamically loadable resource AssetBundle which is associated with each platform, so that the advantage that the associated resources of the corresponding platform can be provided when a user uses the system is realized.
It can be seen that, in this embodiment, the 3D model can be uploaded to a cloud, and the 3D model can be transmitted to a preset 3D model handler after being received by the cloud, and the game engine Unity on the 3D model handler can be started by using a remote call through the cloud, and the 3D model handler of the 3D model handler can be opened, and the 3D model can be read by using a plug-in through the 3D model handler, and the 3D model read by using the plug-in can be stored in a memory, it is necessary to store the 3D model read by using the plug-in on a hard disk first, so as to form a resource available for Unity, and the 3D model stored on the hard disk can be converted into a series of dynamically loadable resources AssetBundle by using a tool based on the Unity engine, which are platform-related, each platform corresponds to one resource, wherein one platform corresponds to one dynamically loadable resource AssetBundle, so that a user can dynamically load a 3D model on various platforms by himself, and the requirement that the user introduces the 3D model and uses the model on various platforms by himself can be met.
Further, in this embodiment, a Unity default file may be created as a storage main body of the 3D model read by the plug-in, and all associated textures in the 3D model read by the plug-in are stored in a hard disk and a mapping table of the associated textures stored in the hard disk is generated, and all material information included in the 3D model read by the plug-in is read, and according to the generated mapping table of the associated textures, all texture information included in all the read material information is replaced by new texture information, and all the read material information is stored in the hard disk, one material information corresponds to one material file, and the main body information of the 3D model read by the plug-in is stored in the created default file, so as to form a resource available for Unity, which has an advantage that the created default file can be associated with all material files, the material file can be associated with all the associated texture files in the 3D model read by the plug-in.
Further, in this embodiment, all the associated textures in the 3D model read by using the plug-in may be loaded into the memory, creating a new texture with the same size as the associated texture loaded into the memory, drawing the content of the associated texture loaded into the memory to the new texture, compressing the new texture according to a preset format and storing the new texture to a hard disk, each texture of the new texture corresponds to an image file of the preset format, and a mapping table of the associated texture loaded into the memory and the new texture is recorded, the mapping table is used for modifying the texture mapping relation in the associated material file, and the method has the advantage that all associated textures in the 3D model which cannot be directly stored in the hard disk and is read by the plug-in can be stored in the hard disk.
Further, in this embodiment, according to the complexity of the Unity resource stored in the hard disk and the scale of the associated resource, the Unity resource stored in the hard disk may be called by using a format conversion method to a corresponding interface of Unity, and a dynamically loadable resource AssetBundle associated with each platform is generated, where one platform corresponds to one dynamically loadable resource AssetBundle.
Referring to fig. 2, fig. 2 is a flowchart illustrating another embodiment of the dynamic loading method based on the Unity engine according to the present invention. In this embodiment, the method includes the steps of:
s201: and uploading the 3D model to a cloud.
As described above in S101, further description is omitted here.
S202: and after receiving the 3D model at the cloud end, transmitting the 3D model to a preset 3D model processor.
As described above in S102, further description is omitted here.
S203: and starting the game engine Unity on the 3D model processor in a remote calling mode through the cloud, and opening a 3D model processing program of the 3D model processor.
As described above in S103, which is not described herein.
S204: the 3D model is read by the 3D model handler using a plug-in.
As described above in S104, and will not be described herein.
S205: and storing the 3D model read by the plug-in into a memory, wherein the 3D model read by the plug-in is required to be stored on a hard disk to form a resource available for Unity.
As described above in S105, which is not described herein.
S206: the 3D model stored on the hard disk is converted into a series of dynamically loadable resources, assetBundle, by using a Unity engine-based tool, wherein the resources are platform-related, and each platform corresponds to one resource.
As described above in S106, and will not be described herein.
S207: and collecting and recording file information of the dynamically loadable resource AssetBundle associated with each generated platform through the cloud.
It can be found that in this embodiment, the file information of the dynamically loadable resource AssetBundle that generates the association of each platform may be collected and recorded by the cloud, which has the advantage that the associated resource of the corresponding platform can be provided when the user uses the file information.
The invention also provides a dynamic loading device based on the Unity engine, which can realize that a user can dynamically load the 3D model on various platforms by himself and can meet the requirement that the user can import the 3D model and use the model on various platforms by himself.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an embodiment of a Unity engine based dynamic loading apparatus according to the present invention. In this embodiment, the Unity engine-based dynamic loading apparatus 30 includes an uploading module 31, a transmission module 32, a starting module 33, a reading module 34, a storage module 35, and a conversion module 36.
The uploading module 31 is configured to upload the 3D model to the cloud.
The transmission module 32 is configured to transmit the 3D model to a preset 3D model processor after the 3D model is received by the cloud.
The starting module 33 is configured to start the game engine Unity on the 3D model handler in a remote invocation manner through the cloud, and open a 3D model handler of the 3D model handler.
The reading module 34 is configured to read the 3D model through the 3D model processing program by using a plug-in.
The storage module 35 is configured to store the 3D model read by the plug-in the memory, and the 3D model read by the plug-in needs to be stored in the hard disk first, so as to form a Unity-available resource.
The conversion module 36 is configured to convert the 3D model stored on the hard disk into a series of dynamically loadable resources AssetBundle by using a Unity engine-based tool, where the resources are platform-related and each platform corresponds to a resource.
Optionally, the storage module 35 may be specifically configured to:
creating a Unity preset file as a storage main body of the 3D model read by the plug-in; storing all the associated textures in the 3D model read by the plug-in to a hard disk and generating a mapping table of the associated textures stored in the hard disk; reading all the material information contained in the 3D model read by using the plug-in, and replacing all the texture information contained in the read material information with newly-built texture information according to the generated mapping table of the associated texture; storing all the read material information into a hard disk, wherein one piece of material information corresponds to one material file; and storing the main body information of the 3D model read by using the plug-in the created preset file to form a resource available for Unity.
Optionally, the storage module 35 may be specifically configured to:
loading all the associated textures in the 3D model read by the plug-in into a memory; and creating a new texture corresponding to the size of the associated texture loaded into memory; and drawing the content of the associated texture loaded into the memory to the new texture; compressing the new texture according to a preset format and storing the new texture into a hard disk, wherein each texture of the new texture corresponds to an image file of the preset format; recording the mapping table of the associated texture loaded into the memory and the new texture; the mapping table is used for modifying the texture mapping relation in the associated material file.
Optionally, the conversion module 36 may be specifically configured to:
according to the complexity of the Unity resource stored in the hard disk and the scale of the associated resource, calling a corresponding interface of Unity by adopting a format conversion mode for the Unity resource stored in the hard disk, and converting a 3D model stored in the hard disk into a series of dynamically loadable resources, AssetBundle, by using a Unity engine-based tool, wherein the resources are platform-associated and each platform corresponds to one resource.
Referring to fig. 4, fig. 4 is a schematic structural diagram of another embodiment of a Unity engine based dynamic loading apparatus according to the present invention. Different from the previous embodiment, the Unity engine based dynamic loading apparatus 40 of the present embodiment further includes a collection module 41.
The collection module 41 is configured to collect and record file information of the dynamically loadable resource AssetBundle associated with each platform through the cloud.
Each unit module of the Unity engine-based dynamic loading apparatus 30/40 may respectively execute the corresponding steps in the above method embodiments, and therefore, the detailed description of each unit module is omitted here, and please refer to the description of the corresponding steps above.
The present invention further provides a computer device, as shown in fig. 5, comprising: at least one processor 51; and a memory 52 communicatively coupled to the at least one processor 51; the memory 52 stores instructions executable by the at least one processor 51, and the instructions are executed by the at least one processor 51 to enable the at least one processor 51 to execute the Unity engine based dynamic loading method.
Wherein the memory 52 and the processor 51 are coupled in a bus, which may comprise any number of interconnected buses and bridges, which couple one or more of the various circuits of the processor 51 and the memory 52 together. The bus may also connect various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 51 is transmitted over a wireless medium via an antenna, which further receives the data and transmits the data to the processor 51.
The processor 51 is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And the memory 52 may be used to store data used by the processor 51 in performing operations.
The present invention further provides a computer-readable storage medium storing a computer program. The computer program realizes the above-described method embodiments when executed by a processor.
It can be found that, in the above solution, the 3D model can be uploaded to the cloud, and the 3D model can be transmitted to the preset 3D model handler after the 3D model is received by the cloud, and the game engine Unity on the 3D model handler can be started and the 3D model handler of the 3D model handler can be opened by using the remote call mode through the cloud, and the 3D model can be read by using the plug-in through the 3D model handler, and the 3D model read by using the plug-in can be stored in the memory, it is required to store the 3D model read by using the plug-in on the hard disk first, so as to form a resource available for Unity, and the 3D model stored on the hard disk can be converted into a series of dynamically loadable resources AssetBundle by using a tool based on the Unity engine, such resources are platform-related, each platform corresponds to one resource, wherein one platform corresponds to one dynamically loadable resource AssetBundle, so that a user can dynamically load a 3D model on various platforms by himself, and the requirement that the user introduces the 3D model and uses the model on various platforms by himself can be met.
Further, the above solution may create a Unity default file as a storage main body of the 3D model read by the plug-in, store all associated textures in the 3D model read by the plug-in to a hard disk and generate a mapping table of the associated textures stored in the hard disk, read all material information contained in the 3D model read by the plug-in, replace all texture information contained in all read material information with new texture information according to the generated mapping table of the associated textures, store all read material information to the hard disk, one material information corresponding to one material file, and store the main body information of the 3D model read by the plug-in to the created default file to form a resource available for Unity, which is advantageous in that the created default file can be associated with all material files, the material file can be associated with all the associated texture files in the 3D model read by the plug-in.
Furthermore, the above solution can load all the associated textures in the 3D model read by using the plug-in into the memory, creating a new texture with the same size as the associated texture loaded into the memory, drawing the content of the associated texture loaded into the memory to the new texture, compressing the new texture according to a preset format and storing the new texture to a hard disk, each texture of the new texture corresponds to an image file of the preset format, and a mapping table of the associated texture loaded into the memory and the new texture is recorded, the mapping table is used for modifying the texture mapping relation in the associated material file, and the method has the advantage that all associated textures in the 3D model which cannot be directly stored in the hard disk and is read by the plug-in can be stored in the hard disk.
Further, according to the above scheme, according to the complexity of the Unity resource stored in the hard disk and the scale of the associated resource, the Unity resource stored in the hard disk can be used for calling the corresponding interface of Unity in a format conversion manner to generate the dynamically loadable resource AssetBundle associated with each platform, wherein one platform corresponds to one dynamically loadable resource AssetBundle, so that the advantage that a user can dynamically load a 3D model on various platforms by himself is achieved, and the need that the user can import the 3D model and use the model on various platforms by himself can be met.
Further, according to the scheme, the file information of the dynamically loadable resource AssetBundle which is associated with each platform can be collected and recorded through the cloud, and the advantage that the associated resources of the corresponding platform can be provided when a user uses the file information is achieved.
In the several embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a module or a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be substantially or partially implemented in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only a part of the embodiments of the present invention, and not intended to limit the scope of the present invention, and all equivalent devices or equivalent processes performed by the present invention through the contents of the specification and the drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A dynamic loading method based on a Unity engine is characterized by comprising the following steps:
uploading the 3D model to a cloud;
after the cloud receives the 3D model, transmitting the 3D model to a preset 3D model processor;
starting a game engine Unity on the 3D model processor in a remote calling mode through the cloud, and opening a 3D model processing program of the 3D model processor;
reading, by the 3D model handler, the 3D model using a plug-in;
storing the 3D model read by the plug-in into a memory, wherein the 3D model read by the plug-in is required to be stored on a hard disk to form a Unity available resource;
the 3D model stored on the hard disk is converted into a series of dynamically loadable resources, assetBundle, by using a Unity engine-based tool, wherein the resources are platform-related, and each platform corresponds to one resource.
2. The Unity engine-based dynamic loading method as claimed in claim 1, wherein the storing the 3D model read by using the plug-in into the memory requires that the 3D model read by using the plug-in is stored on a hard disk to form a Unity available resource, and the method comprises:
creating a Unity preset file as a storage main body of the 3D model read by the plug-in;
storing all the associated textures in the 3D model read by using the plug-in to a hard disk and generating a mapping table of the associated textures stored in the hard disk;
reading all the material information contained in the 3D model read by using the plug-in, and replacing all the texture information contained in the read material information with newly-built texture information according to the generated mapping table of the associated texture;
storing all the read material information into a hard disk, wherein one piece of material information corresponds to one material file;
and storing the main body information of the 3D model read by using the plug-in the created preset file to form a resource available for Unity.
3. The Unity engine-based dynamic loading method according to claim 2, wherein the storing all associated textures in the 3D model read by using the plug-in to a hard disk and generating the mapping table of the associated textures existing to the hard disk comprises:
loading all the associated textures in the 3D model read by the plug-in into a memory;
and creating a new texture corresponding to the size of the associated texture loaded into memory;
and drawing the content of the associated texture loaded into the memory to the new texture;
compressing the new textures according to a preset format and storing the new textures in a hard disk, wherein each texture of the new textures corresponds to an image file in the preset format;
recording the mapping table of the associated texture loaded into the memory and the new texture; and the mapping table is used for modifying the texture mapping relation in the associated material file.
4. The Unity engine-based dynamic loading method as claimed in claim 1, wherein the Unity engine-based tool is used to convert the 3D model stored on the hard disk into a series of dynamically loadable resources AssetBundle, the resources being platform-related, one for each platform, comprising:
according to the complexity of the Unity resource stored in the hard disk and the scale of the associated resource, calling a corresponding interface of Unity by adopting a format conversion mode for the Unity resource stored in the hard disk, and converting the 3D model stored in the hard disk into a series of dynamically loadable resources, AssetBundle, by using a Unity engine-based tool, wherein the resources are platform-associated and each platform corresponds to one resource.
5. The Unity engine-based dynamic loading method as claimed in claim 1, wherein after said using the Unity engine-based tool to convert the 3D model stored on the hard disk into a series of dynamically loadable resources assetbundles, such resources being platform-dependent, each platform corresponding to a resource, further comprising:
and collecting and recording file information of the dynamically loadable resource AssetBundle associated with each generated platform through the cloud.
6. A dynamic loading device based on a Unity engine is characterized by comprising:
the device comprises an uploading module, a transmission module, a starting module, a reading module, a storage module and a conversion module;
the uploading module is used for uploading the 3D model to a cloud end;
the transmission module is used for transmitting the 3D model to a preset 3D model processor after the cloud receives the 3D model;
the starting module is used for starting a game engine Unity on the 3D model processor in a remote calling mode through the cloud end and opening a 3D model processing program of the 3D model processor;
the reading module is used for reading the 3D model by using a plug-in through the 3D model processing program;
the storage module is used for storing the 3D model read by the plug-in into a memory, and the 3D model read by the plug-in is required to be stored on a hard disk to form a Unity available resource;
the conversion module is used for converting the 3D model stored on the hard disk into a series of dynamically loadable resources, AssetBundle, by using a Unity engine-based tool, wherein the resources are associated with platforms, and each platform corresponds to one resource.
7. The Unity engine-based dynamic loading apparatus as claimed in claim 6, wherein said storage module is specifically configured to:
creating a preset file of Unity as a storage main body of the 3D model read by the plug-in; storing all the associated textures in the 3D model read by using the plug-in to a hard disk and generating a mapping table of the associated textures stored in the hard disk; reading all the material information contained in the 3D model read by using the plug-in, and replacing all the texture information contained in the read material information with newly-built texture information according to the generated mapping table of the associated texture; storing all the read material information into a hard disk, wherein one piece of material information corresponds to one material file; and storing the main body information of the 3D model read by using the plug-in the created preset file to form a resource available for Unity.
8. The Unity engine-based dynamic loading apparatus as claimed in claim 6, wherein said storage module is specifically configured to:
loading all the associated textures in the 3D model read by the plug-in into a memory; and creating a new texture corresponding to the size of the associated texture loaded into memory; and drawing the content of the associated texture loaded into the memory to the new texture; compressing the new textures according to a preset format and storing the new textures in a hard disk, wherein each texture of the new textures corresponds to an image file in the preset format; recording the mapping table of the associated texture loaded into the memory and the new texture; and the mapping table is used for modifying the texture mapping relation in the associated material file.
9. The Unity engine-based dynamic loading apparatus according to claim 6, wherein the translation module is specifically configured to:
according to the complexity of the Unity resource stored in the hard disk and the scale of the associated resource, calling a corresponding interface of Unity by adopting a format conversion mode for the Unity resource stored in the hard disk, and converting the 3D model stored in the hard disk into a series of dynamically loadable resources, AssetBundle, by using a Unity engine-based tool, wherein the resources are platform-associated and each platform corresponds to one resource.
10. The Unity engine based dynamic loading apparatus as claimed in claim 6, wherein said Unity engine based dynamic loading apparatus further comprises:
a collection module;
and the collection module is used for collecting and recording file information of the dynamically loadable resource AssetBundle associated with each generated platform through the cloud.
CN202011022730.3A 2020-09-25 2020-09-25 Dynamic loading method and device based on Unity engine and computer equipment Pending CN112199126A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011022730.3A CN112199126A (en) 2020-09-25 2020-09-25 Dynamic loading method and device based on Unity engine and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011022730.3A CN112199126A (en) 2020-09-25 2020-09-25 Dynamic loading method and device based on Unity engine and computer equipment

Publications (1)

Publication Number Publication Date
CN112199126A true CN112199126A (en) 2021-01-08

Family

ID=74007170

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011022730.3A Pending CN112199126A (en) 2020-09-25 2020-09-25 Dynamic loading method and device based on Unity engine and computer equipment

Country Status (1)

Country Link
CN (1) CN112199126A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114065078A (en) * 2021-11-25 2022-02-18 广州四三九九信息科技有限公司 Method for browsing and packaging Assetstunle resource
WO2023045785A1 (en) * 2021-09-22 2023-03-30 北京有竹居网络技术有限公司 Game engine resource processing method and apparatus, and storage medium and electronic device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102799456A (en) * 2012-07-24 2012-11-28 上海晨思电子科技有限公司 Method and device for uploading resource files by game engine, and computer
CN105787991A (en) * 2014-12-22 2016-07-20 深圳中兴力维技术有限公司 Unity 3D technology-based resource reuse implementation method and device thereof
US20180293802A1 (en) * 2017-04-07 2018-10-11 Unveil, LLC Systems and methods for mixed reality medical training
CN108897567A (en) * 2018-06-08 2018-11-27 广州虎牙信息科技有限公司 Method, apparatus, equipment and the storage medium of software load document based on Unity
CN109508319A (en) * 2018-11-09 2019-03-22 武汉兴联云立方科技有限公司 A kind of cross-platform resource management system of 3D and method
CN111569431A (en) * 2019-02-18 2020-08-25 厦门雅基软件有限公司 Game engine resource processing method, electronic device and computer readable storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102799456A (en) * 2012-07-24 2012-11-28 上海晨思电子科技有限公司 Method and device for uploading resource files by game engine, and computer
US20140033219A1 (en) * 2012-07-24 2014-01-30 Mstar Semiconductor, Inc. Method, apparatus and computer for loading resource file for game engine
CN105787991A (en) * 2014-12-22 2016-07-20 深圳中兴力维技术有限公司 Unity 3D technology-based resource reuse implementation method and device thereof
US20180293802A1 (en) * 2017-04-07 2018-10-11 Unveil, LLC Systems and methods for mixed reality medical training
CN108897567A (en) * 2018-06-08 2018-11-27 广州虎牙信息科技有限公司 Method, apparatus, equipment and the storage medium of software load document based on Unity
CN109508319A (en) * 2018-11-09 2019-03-22 武汉兴联云立方科技有限公司 A kind of cross-platform resource management system of 3D and method
CN111569431A (en) * 2019-02-18 2020-08-25 厦门雅基软件有限公司 Game engine resource processing method, electronic device and computer readable storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023045785A1 (en) * 2021-09-22 2023-03-30 北京有竹居网络技术有限公司 Game engine resource processing method and apparatus, and storage medium and electronic device
CN114065078A (en) * 2021-11-25 2022-02-18 广州四三九九信息科技有限公司 Method for browsing and packaging Assetstunle resource
CN114065078B (en) * 2021-11-25 2024-04-09 广州四三九九信息科技有限公司 Browsing and packing method for Assetbond resources

Similar Documents

Publication Publication Date Title
Rawassizadeh et al. UbiqLog: a generic mobile phone-based life-log framework
US8145653B2 (en) Using schemas to generate application specific business objects for use in an integration broker
CN110311973B (en) Multi-tenant-oriented image cloud service system and method
CN112199126A (en) Dynamic loading method and device based on Unity engine and computer equipment
CN105719329B (en) Bookkeeping voucher generation method and system
CN102480525B (en) Server device in thin-client system
CN103853535B (en) The method and apparatus for changing middleware
US10516791B2 (en) Information processing system, information processing apparatus, and information processing method for executing an iteration of one or more processes
CN103092602A (en) Software development kit and terminal apparatus
CN100543737C (en) Raw data is transferred to the mechanism of another structure from a data structure
US8265919B1 (en) Emulating a peripheral mass storage device with a portable device
CN109857404A (en) The packaging method and device of SDK interface, storage medium, electronic equipment
CN102456033A (en) General page querying method, system and terminal
CN113672204A (en) Interface document generation method, system, electronic equipment and storage medium
CN104364779A (en) Service provision system, service computer, and terminal
CN109857387A (en) A kind of method and electronic equipment generating JAVA class object
CN113656359A (en) Method and device for lightening three-dimensional model, computer equipment and storage medium
CN105320669A (en) Method and device for data storage and method and device for data reading
CN104364786A (en) A method and computer program product for task management on late clinical information
EP1256891A2 (en) Method and apparatus for formula evaluation in spreadsheets on small devices
CN108616603B (en) Method and system for synchronizing internal and external network data
CN116319878A (en) Method, equipment and computer storage medium for data transmission
KR102155551B1 (en) Apparatus and Method for Simulating wave power
CN112468829B (en) Sharing method of cache video, electronic device and computer readable storage medium
CN106796512B (en) Method for projecting working space and system applying same

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination