Methods, apparatus, and integration systems based on Unity3D engine and native client.
By setting up a listener in the Unity3D engine editor environment to listen for protocol messages from the native client and dispatch them to the corresponding modules for processing, the problem of low debugging efficiency of native client programs is solved, and efficient hybrid development and joint debugging are achieved.
Patent Information
- Application Number
- CN202310569403.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-18
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2043-05-18
AI Technical Summary
In existing technologies, debugging native client programs is inefficient, requiring repeated embedding of programs between Unity3D business modules and native clients for debugging, resulting in extremely low efficiency.
In the Unity3D engine editor environment, a Unity3D service listener is set up to listen for protocol messages from the target Native client, determine the matching target Unity3D business module, and dispatch the protocol messages to the module for business processing, such as debugging, without needing to be repeatedly packaged and embedded in the Native client.
It improves the efficiency and accuracy of hybrid development and joint debugging of Unity3D engine and native client, and enables viewing of business processing results consistent with native client in Unity3D engine editor environment, as well as breakpoint and log debugging.
Smart Images

Figure CN116684337B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus and system for joint debugging based on the Unity3D engine and native client. Background Technology
[0002] With the rapid development of Internet technology, more and more native clients are incorporating the Unity3D engine for hybrid development and debugging in order to add 3D scenes and enhance visual performance, in order to achieve high-quality visual presentation effects. Examples include: embedding Unreal Engine in interactive software, adding virtual live streaming to live streaming clients, and adding 3D in-vehicle display modules to in-vehicle systems.
[0003] In existing technologies, when it is necessary to develop and debug a program for a native client, the development and debugging are first carried out in the Unity3D business module. After the development and debugging are completed, the Unity3D business module is exported from the Unity3D engine editing environment and embedded into the native client. Then, the actual running effect is previewed in the native client, and subsequent operations, such as finding and locating problems, are performed based on the logs corresponding to the actual running effect in the native client.
[0004] However, in practice, it has been found that when problems arise, it is necessary to return to the Unity3D business module to debug the program, and then re-embed the debugged Unity3D business module into the native client to preview the actual effect. This process is repeated until the program is problem-free. Clearly, the current program debugging method is extremely inefficient. Therefore, proposing a technical solution to improve program debugging efficiency is particularly important. Summary of the Invention
[0005] This invention provides a method, apparatus, and system for joint debugging based on the Unity3D engine and a native client, which can improve program debugging efficiency.
[0006] To address the aforementioned technical problems, the first aspect of this invention discloses a method for joint debugging between the Unity3D engine and a native client, the method comprising:
[0007] Based on the established Unity3D service listener, the protocol messages of the target business sent by the target Native client are listened to in the established protocol service environment. Both the Unity3D service listener and the protocol service environment are established in the Unity3D engine editor environment.
[0008] Based on the protocol message of the target service, determine the target Unity3D service module that matches the target service;
[0009] The protocol message of the target service is dispatched to the target Unity3D service module to trigger the target Unity3D service module to perform service processing on the target service according to the protocol message of the target service. The service processing includes debugging processing.
[0010] As an optional implementation, in the first aspect of the present invention, the method further includes:
[0011] The parameters of the URL and port to be monitored are determined. The URL and port are used for communication between the first Native client and the Unity3D service listener. The first Native client includes the target Native client.
[0012] In the Unity3D engine editor environment, the URL and port are set for the Unity3D service listener according to the parameters of the URL and the port.
[0013] After setting the URL and port, start listening for the URL and port, and in the Unity3D engine editor environment, set the callback method for listening to the protocol messages sent by the first Native client, thus completing the construction of the protocol service environment and the Unity3D service listener.
[0014] As an optional implementation, in the first aspect of the present invention, the step of listening to protocol messages of the target business sent by the target Native client in the established protocol service environment based on the established Unity3D service listener includes:
[0015] Based on the established Unity3D service listener, a connection is established with the target Native client through the URL and port in the established protocol service environment;
[0016] After a successful connection, listen for the protocol messages of the target service sent by the target native client, wherein the protocol messages of the target service are messages sent by the target native client in a preset file format.
[0017] As an optional implementation, in the first aspect of the present invention, before dispatching the protocol message of the target service to the target Unity3D service module to trigger the target Unity3D service module to perform service processing on the target service according to the protocol message of the target service, the method further includes:
[0018] The protocol message of the target service is added to a pre-determined message queue. The message queue is used to store protocol messages of all services sent from the second Native client, which includes the target Native client. The protocol messages of all services include the protocol message of the target service.
[0019] Based on the message status in the message queue, determine the message loop mode corresponding to the message queue;
[0020] The step of dispatching the protocol message of the target service to the target Unity3D service module to trigger the target Unity3D service module to perform service processing on the target service according to the protocol message includes:
[0021] According to the message loop method, the Unity3D-Native client interaction method is invoked to dispatch the protocol message of the target business to the target Unity3D business module, so as to trigger the target Unity3D business module to perform business processing on the target business according to the protocol message of the target business, and the business processing includes debugging processing.
[0022] As an optional implementation, before adding the protocol message of the target service to the predetermined message queue, the method further includes:
[0023] Obtain the current target status in the Unity3D engine editor environment. The target status includes the message status in the message queue and / or the processing thread status. The message status includes the message data volume and / or message type. The processing thread status includes the status of all threads in the Unity3D engine editor environment. Different threads are used to handle different operations.
[0024] Based on the target situation and the content contained in the protocol message of the target service, determine whether the protocol message of the target service meets the predetermined message storage conditions;
[0025] When the result is determined to be yes, the operation of adding the protocol message of the target service to a pre-determined message queue is triggered.
[0026] As an optional implementation, in the first aspect of the present invention, the protocol message of the target service includes at least one of the identifier of the target service, the protocol content of the target service, and the storage path corresponding to the target service, wherein the storage path corresponding to the target service is used to store the protocol content of the target service, and the identifier of the target service includes the protocol command identifier of the target service and / or the message identifier of the target service.
[0027] The protocol command identifier of the target service includes one or more of the following: model loading identifier, model unloading identifier, and server data identifier.
[0028] As an optional implementation, in the first aspect of the present invention, determining the target Unity3D service module matching the target service based on the protocol message of the target service includes:
[0029] Determine the quantity of the target service;
[0030] When the number of the target services is equal to 1, the target Unity3D service module matching the target service is determined according to the protocol command identifier of the target service;
[0031] When the number of target services is greater than 1, the target Unity3D service module that matches the target service is determined according to the protocol command identifier and message identifier of each target service.
[0032] A second aspect of this invention discloses an apparatus for co-working between the Unity3D engine and a native client, the apparatus comprising:
[0033] The listening module is used to listen for protocol messages of the target business sent by the target Native client in the built protocol service environment based on the built Unity3D service listener. Both the Unity3D service listener and the protocol service environment are built in the Unity3D engine editor environment.
[0034] The determination module is used to determine the target Unity3D business module that matches the target business protocol message based on the target business protocol message;
[0035] The dispatch module is used to dispatch the target business protocol message to the target Unity3D business module to trigger the target Unity3D business module to perform business processing on the target business protocol message, and the business processing includes debugging processing.
[0036] As an optional implementation, in a second aspect of the present invention, the determining module is further configured to determine the parameters of the URL to be monitored and the parameters of the port, wherein the URL and the port are used for communication between the first Native client and the Unity3D service listener, and the first Native client includes the target Native client;
[0037] The device further includes:
[0038] The configuration module is used to set the URL and port for the Unity3D service listener in the Unity3D engine editor environment, based on the parameters of the URL and the port.
[0039] The monitoring module is also used to start a monitoring operation on the URL and the port after the URL and the port are set;
[0040] The settings module is also used to set the callback method for listening to the protocol messages sent by the first Native client in the Unity3D engine editor environment, thereby completing the construction of the protocol service environment and the Unity3D service listener.
[0041] As an optional implementation, in the second aspect of the present invention, the specific method by which the listening module listens for protocol messages of the target business sent by the target Native client in the established protocol service environment based on the established Unity3D service listener includes:
[0042] Based on the established Unity3D service listener, a connection is established with the target Native client through the URL and port of the established protocol service environment;
[0043] After a successful connection, listen for the protocol messages of the target service sent by the target native client, wherein the protocol messages of the target service are messages sent by the target native client in a preset file format.
[0044] As an optional implementation, in a second aspect of the invention, the apparatus further includes:
[0045] An adding module is used to add the protocol message of the target service to a predetermined message queue before the dispatching module dispatches the protocol message of the target service to the target Unity3D service module to trigger the target Unity3D service module to perform service processing according to the protocol message of the target service. The message queue is used to store the protocol messages of all services sent from the second Native client, the second Native client including the target Native client, and the protocol messages of all services include the protocol message of the target service.
[0046] The determining module is further configured to determine the message looping mode corresponding to the message queue based on the message status in the message queue;
[0047] The specific method by which the dispatch module dispatches the protocol message of the target service to the target Unity3D service module to trigger the target Unity3D service module to perform service processing according to the protocol message of the target service includes:
[0048] According to the message loop method, the Unity3D-Native client interaction method is invoked to dispatch the protocol message of the target business to the target Unity3D business module, so as to trigger the target Unity3D business module to perform business processing on the target business according to the protocol message of the target business, and the business processing includes debugging processing.
[0049] As an optional implementation, in a second aspect of the invention, the apparatus further includes:
[0050] The acquisition module is used to acquire the current target status in the Unity3D engine editor environment before the addition module adds the protocol message of the target business to the predetermined message queue. The target status includes the message status and / or processing thread status in the message queue. The message status includes the message data volume and / or message type. The processing thread status includes the status of all threads in the Unity3D engine editor environment. Different threads are used to handle different operations.
[0051] The judgment module is used to determine whether the target service protocol message meets the predetermined message storage conditions based on the target situation and the content contained in the target service protocol message; when the judgment result is yes, the adding module is triggered to perform the operation of adding the target service protocol message to the predetermined message queue.
[0052] As an optional implementation, in a second aspect of the present invention, the protocol message of the target service includes at least one of the identifier of the target service, the protocol content of the target service, and the storage path corresponding to the target service, wherein the storage path corresponding to the target service is used to store the protocol content of the target service, and the identifier of the target service includes the protocol command identifier of the target service and / or the message identifier of the target service.
[0053] The protocol command identifier of the target service includes one or more of the following: model loading identifier, model unloading identifier, and server data identifier.
[0054] As an optional implementation, in the second aspect of the present invention, the specific method by which the determining module determines the target Unity3D business module matching the target business according to the protocol message of the target business includes:
[0055] Determine the quantity of the target service;
[0056] When the number of the target services is equal to 1, the target Unity3D service module matching the target service is determined according to the protocol command identifier of the target service;
[0057] When the number of target services is greater than 1, the target Unity3D service module that matches the target service is determined according to the protocol command identifier and message identifier of each target service.
[0058] A third aspect of the present invention discloses another apparatus for joint debugging of the Unity3D engine and a native client, the apparatus comprising:
[0059] Memory containing executable program code;
[0060] A processor coupled to the memory;
[0061] The processor calls the executable program code stored in the memory to execute some or all of the steps in any of the methods for joint debugging based on the Unity3D engine and the Native client disclosed in the first aspect of the present invention.
[0062] The fourth aspect of the present invention discloses a computer storage medium storing computer instructions, which, when invoked, are used to execute some or all of the steps in any of the methods for joint debugging based on the Unity3D engine and the Native client disclosed in the first aspect of the present invention.
[0063] The fifth aspect of the present invention discloses a joint debugging system, which is used to perform some or all of the steps in any of the joint debugging methods based on the Unity3D engine and the Native client disclosed in the first aspect of the present invention.
[0064] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0065] In this embodiment of the invention, a Unity3D service listener built in the Unity3D engine editor environment listens for protocol messages of the target business sent by the target Native client in the built protocol service environment. Based on the protocol messages of the target business, a target Unity3D business module matching the target business is determined. The protocol messages of the target business are dispatched to the Unity3D business module to trigger the Unity3D business module to perform business processing on the target business according to the protocol messages of the target business. This business processing includes debugging processing. Therefore, this invention, by having a Unity3D service listener built in the Unity3D engine editor environment listen for protocol messages of the business sent by the Native client in the built protocol service environment and dispatch them to the corresponding Unity3D business module for business processing, such as debugging processing, eliminates the need to repeatedly embed the Unity3D business module into the Native client for packaging. This allows for viewing the same business processing results in the Unity3D engine editor environment as in the Native client environment, and enabling breakpoint and log debugging based on the business processing results in the Unity3D engine editor environment. This improves the efficiency and accuracy of hybrid development and joint debugging of the Unity3D engine and Native client. Attached Figure Description
[0066] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0067] Figure 1 This is a schematic diagram of the system architecture of a method for joint debugging based on the Unity3D engine and a native client disclosed in an embodiment of the present invention;
[0068] Figure 2 This is a flowchart illustrating a method for joint debugging between the Unity3D engine and a native client, as disclosed in an embodiment of the present invention.
[0069] Figure 3This is a flowchart illustrating another method for joint debugging between the Unity3D engine and a native client disclosed in an embodiment of the present invention.
[0070] Figure 4 This is a schematic diagram of the structure of a device for joint debugging of Unity3D engine and Native client disclosed in an embodiment of the present invention;
[0071] Figure 5 This is a schematic diagram of another device based on the Unity3D engine and Native client for joint debugging disclosed in an embodiment of the present invention;
[0072] Figure 6 This is a schematic diagram of the structure of another device based on the Unity3D engine and Native client for joint debugging disclosed in an embodiment of the present invention;
[0073] Figure 7 This is a schematic diagram of the structure of a joint debugging system disclosed in an embodiment of the present invention. Detailed Implementation
[0074] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0075] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or end that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or ends.
[0076] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0077] This invention discloses a method, apparatus, and system for joint debugging based on the Unity3D engine and a native client. By using a Unity3D service listener built in the Unity3D engine editor environment, the system listens for protocol messages from the native client within a pre-built protocol service environment and dispatches them to the corresponding Unity3D business module for business processing, such as debugging. This eliminates the need to repeatedly embed the Unity3D business module into the native client for repackaging. It allows users to view the same business processing results in the Unity3D engine editor environment as in the native client environment and perform breakpoint and log debugging based on the business processing results. This improves the efficiency and accuracy of hybrid development and joint debugging between the Unity3D engine and the native client.
[0078] To better understand the method, apparatus, and system for joint debugging based on the Unity3D engine and native client described in this invention, the system architecture of the method for joint debugging based on the Unity3D engine and native client is first described. Specifically, the system architecture can be as follows: Figure 1 As shown, Figure 1 This is a schematic diagram of the system architecture of a method for joint debugging based on the Unity3D engine and a native client, as disclosed in an embodiment of the present invention. Figure 1 As shown, the system architecture can include a Unity3D editor and a native client. The native client includes an Android client or an iOS client. The Unity3D engine editor environment includes a Unity3D service listener and a Unity3D business module. The Unity3D service listener listens for protocol messages sent by the native client. When a protocol message is received, the listener determines the matching target Unity3D business module for the protocol message and dispatches the protocol message to the matching target Unity3D business module for business processing, thereby achieving efficient and accurate development and integration testing.
[0079] It should be noted that the above content is only a schematic description of the system architecture corresponding to the present invention. There are no limitations on the number / type of Native clients, the number / type of Uniy3D service listeners, and the number / type of Unity3D business modules. For the specific implementation process, please refer to the following embodiments.
[0080] Example 1
[0081] Please see Figure 2 , Figure 2This is a flowchart illustrating a method for joint debugging between the Unity3D engine and a native client, as disclosed in an embodiment of the present invention. Figure 2 The described method can be applied to scenarios where a device configured for joint debugging based on the Unity3D engine and a native client exists, and where virtual objects exist. These virtual objects include virtual characters and / or virtual animals and / or virtual items, and the device can include one of the following: a debugging device, a debugging server, a debugging platform, or a debugging system. Figure 2 As shown, this method for co-working between the Unity3D engine and the native client can include the following operations:
[0082] 101. Based on the established Unity3D service listener, listen for the target business protocol messages sent by the target Native client in the established protocol service environment. Both the Unity3D service listener and the protocol service environment are established in the Unity3D engine editor environment.
[0083] In this embodiment of the invention, the protocol service environment is used to enable communication between the Unity3D service listener and the native client, and the protocol corresponding to the protocol service environment includes, but is not limited to, any one of the protocols that can achieve communication, such as HTTP, TCP, and URP.
[0084] 102. Based on the protocol messages of the target business, determine the target Unity3D business module that matches the target business.
[0085] In this embodiment of the invention, multiple Unity3D business modules exist within the Unity3D engine editor environment, and different Unity3D business modules are used to handle different business functions. Optionally, the number of Unity3D business modules handling the same business function can be greater than or equal to one.
[0086] In this embodiment of the invention, the protocol message of the target service includes at least one of the following: an identifier of the target service, protocol content of the target service, and a storage path corresponding to the target service. The storage path corresponding to the target service is used to store the protocol content of the target service. The identifier of the target service includes a protocol command identifier and / or a message identifier of the target service. The protocol command identifier of the target service includes, but is not limited to, one or more of a model loading identifier, a model unloading identifier, and a server-side data identifier. The message identifier of the target service is used to distinguish the target service and the protocol messages within the target service's protocol messages, excluding the message identifier. It is also used to add the protocol messages to the message queue in an orderly manner, and the message identifier of each target service can be incremented by 1. The initial value of the message identifier used to identify the service in the message queue can be any initial value, such as 2000000.
[0087] In this embodiment of the invention, the target Unity3D business module matching the target business is determined according to the protocol message of the target business, including:
[0088] Determine the parameters of the target service, including the quantity and type of the target service;
[0089] When the number of target services is equal to 1, the target Unity3D service module that matches the target service is determined according to the protocol command identifier and type of the target service.
[0090] When the number of target services is greater than 1, the target Unity3D service module that matches the target service is determined based on the protocol command identifier, message identifier and type of each target service.
[0091] As can be seen, the embodiments of the present invention can also determine the matching target Unity3D business module by selecting the corresponding identifier and combining it with the type of business based on the quantity and type of business sent by the Native client. This enables accurate and rapid determination of the Unity3D business module, especially when the protocol command identifiers of the sent business are the same.
[0092] 103. Dispatch the protocol message of the target business to the target Unity3D business module to trigger the target Unity3D business module to perform business processing on the target business according to the protocol message of the target business. This business processing includes debugging processing.
[0093] It is evident that implementation Figure 2 The described method enables the listening of protocol messages sent from the native client by a Unity3D service listener set up in the Unity3D engine editor environment. These messages are then dispatched to the corresponding Unity3D business module for business processing, such as debugging. This eliminates the need to repeatedly embed the Unity3D business module into the native client for repackaging. The method allows users to view the same business processing results in the Unity3D engine editor environment as in the native client environment and perform breakpoint and log debugging based on the business processing results. This improves the efficiency and accuracy of hybrid development and joint debugging between the Unity3D engine and the native client.
[0094] In an optional embodiment, the method may further include the following steps:
[0095] Determine the parameters of the URL and port to be monitored. This URL and port are used for communication between the first Native client and the Unity3D service listener. The first Native client includes the aforementioned target Native client.
[0096] In the Unity3D engine editor environment, set the URL and port for the Unity3D service listener according to the URL parameters and port parameters;
[0097] After setting the URL and port, start listening for the URL and port, and in the Unity3D engine editor environment, set the callback method for listening to the protocol messages sent by the first Native client, thus completing the setup of the protocol service environment and the Unity3D service listener.
[0098] In this optional embodiment, the parameters of the URL may include, but are not limited to, one or more of the URL type, URL identifier, and URL function; the parameters of the port may include, but are not limited to, one or more of the port type, port identifier, and port function; and the number of URLs and ports to be monitored may be greater than or equal to 1.
[0099] As can be seen, this optional embodiment, by pre-setting the protocol service environment and Unity3D service listener in the Unity3D engine editor environment according to the parameters of the URL and port to be listened to, as well as the callback method of the protocol messages sent by the Native client, can achieve accurate setup of the protocol service environment and Unity3D service listener, which facilitates subsequent listening operations on the protocol messages sent by the Native client directly in this protocol service environment through the Unity3D service listener.
[0100] In another alternative embodiment, the method may further include the following steps:
[0101] After completing the setup of the protocol service environment and Unity3D service listener, test the accuracy of the Unity3D service listener in listening for protocol messages in this protocol service environment.
[0102] Determine whether the above listening accuracy is greater than or equal to the preset accuracy threshold. If the determination result is yes, test the stability of the Unity3D service listener for listening to protocol messages in this protocol service environment.
[0103] Determine whether the above stability is greater than or equal to the preset stability threshold. Only when the determination result is yes can it be confirmed that the protocol service environment and Unity3D service listener are set up.
[0104] In this optional embodiment, the method may further include the following steps:
[0105] When it is determined that the above monitoring accuracy is less than the preset accuracy threshold or when it is determined that the above monitoring stability is less than the preset stability threshold, calculate the accuracy difference between the monitoring accuracy and the preset accuracy threshold, or calculate the stability difference between the monitoring stability and the preset stability threshold.
[0106] Based on the calculated accuracy difference or stability difference, adjust the parameters of the above URL and port, and re-execute the above steps in the Unity3D engine editor environment to set the URL and port for the Unity3D service listener according to the URL and port parameters; after setting the URL and port, start the listening operation for the URL and port, and in the Unity3D engine editor environment, set the callback method for listening to the protocol messages sent by the first Native client, thus completing the setup of the protocol service environment and the Unity3D service listener.
[0107] As can be seen, this optional embodiment, after initially setting up the protocol service environment and Unity3D service listener, further tests the accuracy and stability of the Unity3D service listener in listening to protocol messages within this protocol service environment. Only when both the listening accuracy and stability are good is the protocol service environment and Unity3D service listener considered properly set up. This ensures the establishment of an accurate and reliable protocol service environment and Unity3D service listener, thereby improving the accuracy and reliability of protocol message listening, and further improving the accuracy and reliability of program development and integration. Furthermore, when the listening accuracy or stability of the Unity3D service listener is less than a preset accuracy threshold or a preset stability threshold, the parameters of the URL and port to be listened to are adjusted based on the accuracy difference or stability difference. This improves the accuracy of determining the parameters of the URL and port to be listened to, thereby ensuring the determination of an accurate and reliable protocol service environment and Unity3D service listener, and further improving the accuracy and success rate of protocol message listening.
[0108] In this optional embodiment, testing the accuracy of the Unity3D service listener in listening to protocol messages in this protocol service environment includes:
[0109] In the protocol service environment, the Unity3D service listener randomly listens for multiple test protocol messages and the first random code corresponding to each test protocol message. The first random code corresponding to each test protocol message is a random code determined based on the identifier of the Native client and the corresponding business type of the test protocol message. Each test protocol message carries a second random code generated based on the corresponding first random code, the identifier of the corresponding Native client, and the business type.
[0110] For each test protocol message that is monitored, a random code is parsed to obtain the third random code of each test protocol message, and the matching degree between the first random code and the corresponding third random code of each test protocol message is calculated.
[0111] Based on the matching degree of all test protocol messages, the total matching degree of all test protocol messages is calculated. This total matching degree serves as the accuracy of the Unity3D service listener in listening to protocol messages within the protocol service environment. A higher total matching degree indicates higher listening accuracy.
[0112] As can be seen, this optional embodiment can also monitor multiple test protocol messages and their corresponding random codes, and determine the accuracy of the Unity3D service listener's monitoring of protocol messages in the protocol service environment based on the matching degree between the monitored random codes and the parsed random codes. This can improve the accuracy of the monitoring accuracy determination, thereby helping to further improve the accuracy and reliability of the Unity3D service listener and protocol service environment setup.
[0113] In this optional embodiment, testing the stability of the Unity3D service listener for listening to protocol messages in this protocol service environment includes:
[0114] In the protocol service environment, the Unity3D service listener randomly listens to the test protocol messages within a preset time period to obtain the listening count of all test protocol messages and the listening data of each test protocol message. Among them, at least one test Native client sends a preset number of test protocol messages and the corresponding test protocol message data to the Unity3D service listener within a preset time period.
[0115] Calculate the data integrity between the listening data of each test protocol message and the corresponding test protocol message data, and calculate the difference between the listening data of all the test protocol messages and the preset number;
[0116] Based on the difference and the data integrity of all test protocol messages, determine the stability of the Unity3D service listener for listening to protocol messages in this protocol service environment.
[0117] As can be seen, this optional embodiment can also analyze the listening stability of the Unity3D service listener for protocol messages in the protocol service environment by listening to the number of multiple test protocol messages, the listening data, and the number and data of test protocol messages generated by the Native client in the same time period. This can improve the accuracy and reliability of the listening stability analysis, thereby helping to further improve the accuracy and reliability of the Unity3D service listener and protocol service environment setup.
[0118] In another optional embodiment, based on the established Unity3D service listener, protocol messages of the target business sent by the target Native client are listened to in the established protocol service environment, including:
[0119] Based on the established Unity3D service listener, a connection is established with the target Native client through the URL and port of the established protocol service environment;
[0120] After a successful connection, listen for protocol messages of the target service sent by the target native client. These protocol messages are messages sent by the target native client in a preset file format.
[0121] In this optional embodiment, the preset file format can be any format capable of communication, such as JSON.
[0122] In this optional embodiment, the Unity3D service listener, based on the established setup, opens the corresponding link through the URL and port in the established protocol service environment, thereby establishing a connection with the target Native client. After the connection is successful, the Unity3D service listener listens for the protocol messages of the target business sent from the target Native client. After listening to the protocol messages of the target business, the connection is closed.
[0123] As can be seen, this optional embodiment establishes a connection with the native client through the URL and port in the established protocol service environment, and listens to the protocol messages sent by the client after the connection is successful. This can improve the accuracy and reliability of protocol message listening, thereby improving the efficiency and accuracy of business processing.
[0124] Example 2
[0125] Please see Figure 3 , Figure 3 This is a flowchart illustrating another method for joint debugging between the Unity3D engine and a native client, as disclosed in an embodiment of the present invention. Figure 3The described method can be applied to scenarios where a device configured for joint debugging based on the Unity3D engine and a native client exists, and where virtual objects exist. These virtual objects include virtual characters and / or virtual animals and / or virtual items, and the device can include one of the following: a debugging device, a debugging server, a debugging platform, or a debugging system. Figure 3 As shown, this method for co-working between the Unity3D engine and the native client can include the following operations:
[0126] 201. Based on the established Unity3D service listener, listen for the target business protocol messages sent by the target Native client in the established protocol service environment. Both the Unity3D service listener and the protocol service environment are established in the Unity3D engine editor environment.
[0127] 202. Based on the protocol messages of the target business, determine the target Unity3D business module that matches the target business.
[0128] 203. Add the protocol message of the target service to a pre-determined message queue. This message queue is used to store the protocol messages of all services sent from the second Native client. The second Native client includes the aforementioned target Native client and other clients. The protocol messages of all services include the protocol message of the aforementioned target service and the protocol messages of other services.
[0129] In this embodiment of the invention, a network read stream of the protocol message of the target service is created in the message queue, and a string carrying the protocol message of the target service is read from the network read stream. The string is then converted into a string of a preset character security format. The converted string is then divided into an array and converted into characters of a preset data structure (such as JsonData). The storage path of the target service is made compatible and the characters are converted into a string. The string is then put into the message queue.
[0130] 204. Determine the message loop mode corresponding to the message queue based on the message status in the message queue.
[0131] In this embodiment of the invention, the message information in the message queue includes one or more of the following: the data volume of protocol messages, the total message capacity of the message queue, protocol messages for all services, and the processing urgency of protocol messages for each service. Higher processing urgency means higher priority for processing. Optionally, the message loop mode corresponding to the message queue is used to indicate that a preset number (e.g., 1 message) of protocol messages are retrieved from the message queue each time.
[0132] 205. Based on the message loop method, call the Unity3D-Native client interaction method to dispatch the target business protocol message to the target Unity3D business module, so as to trigger the target Unity3D business module to perform business processing on the target business according to the target business protocol message. This business processing includes debugging processing.
[0133] In this embodiment of the invention, optionally, after the protocol message of the target business is stored in the message queue in a preset data structure (such as JsonData), before being dispatched to the corresponding target Unity3D business module, the preset data structure string is first converted into a string of Lua table structure, and then broadcast to the target Unity3D business module for business processing.
[0134] In this embodiment of the invention, for the description of other specific technical details of steps 201, 202, and 205, please refer to the description of steps 101-103 in Embodiment 1, which will not be repeated here. It should also be noted that step 202 can occur simultaneously with step 203 or step 204, or it can occur after step 203 and before step 204, or after step 204; this embodiment of the invention does not impose any limitations.
[0135] It is evident that implementation Figure 2 The described method enables the listening of protocol messages sent from native clients within a pre-built protocol service environment using a Unity3D service listener set up in the Unity3D engine editor. These messages are then dispatched to the corresponding Unity3D business modules for processing, such as debugging. This eliminates the need for repeatedly embedding Unity3D business modules into the native client for repackaging. The method allows for viewing consistent runtime results within the Unity3D engine editor environment, just as with the native client, and enables breakpoint and log debugging within the Unity3D engine environment based on the runtime effects. This improves the efficiency and accuracy of hybrid development and debugging between the Unity3D engine and the native client. Furthermore, upon receiving a protocol message, it is first added to a message queue, and then dispatched to the corresponding Unity3D business modules in an orderly manner through a message loop. This reduces the occurrence of blocking during protocol message processing, especially when there are many protocol messages or when multiple protocol messages need to be processed simultaneously, further improving the efficiency of protocol message processing. It also reduces conflicts between the listening thread and the business processing thread, further improving the accuracy and reliability of protocol message processing.
[0136] In an optional embodiment, before adding the protocol message of the target service to a pre-determined message queue, the method may further include the following steps:
[0137] Get the current target status in the Unity3D engine editor environment. The target status includes the message status in the message queue and / or the processing thread status. The message status includes the message data volume and / or message type. The processing thread status includes the status of all threads in the Unity3D engine editor environment. Different threads are used to handle different operations. For example, the listening thread is used to implement the listening operation, and the processing thread is used to implement the listening operation. The status of each thread is used to represent the stability and / or smoothness of the corresponding operation based on that thread.
[0138] Based on the target situation and the content contained in the protocol messages of the target business, determine whether the protocol messages of the target business meet the predetermined message storage conditions.
[0139] When the result is determined to be yes, the operation described above, which adds the target business protocol message to a pre-determined message queue, is triggered.
[0140] In this optional embodiment, if the determination result is negative, the protocol message of the target service is directly dispatched to the target Unity3D service module to trigger the target Unity3D service module to perform service processing on the target service according to the protocol message of the target service. The service processing includes debugging processing.
[0141] In this optional embodiment, optionally, when the amount of message data in the message queue is greater than or equal to a preset amount of data and the protocol command identifier contained in the protocol message of the target service is not a preset protocol command identifier, the message type in the message queue contains a preset message type and the protocol command identifier contained in the protocol message of the target service is not a preset protocol command identifier, and the processing thread status is used to indicate that the stability corresponding to each thread is less than or equal to a preset stability and / or the smoothness is less than or equal to the stability, it is determined that the protocol message of the target service meets the predetermined message storage conditions.
[0142] As can be seen, this optional embodiment improves the accuracy and reliability of adding protocol messages to the message queue by judging whether the protocol message meets the message storage conditions based on the amount, type, and thread processing status of the message data in the message queue in the Unity3D engine editor environment, and only adds the protocol message to the message queue when the conditions are met, thereby further ensuring the accuracy and reliability of the business processing of the protocol message.
[0143] Example 3
[0144] Please see Figure 4 , Figure 4 This is a schematic diagram of a device for joint debugging based on the Unity3D engine and a native client, as disclosed in an embodiment of the present invention. This device can be applied to scenes containing virtual objects, including virtual characters and / or virtual animals and / or virtual items. The device may include one of the following: a debugging device, a debugging server, a debugging platform, or a debugging system. Figure 4 As shown, this device, which integrates the Unity3D engine and a native client, includes:
[0145] The listening module 301 is used to listen for protocol messages of the target business sent by the target Native client in the built protocol service environment based on the built Unity3D service listener. Both the Unity3D service listener and the protocol service environment are built in the Unity3D engine editor environment.
[0146] The determination module 302 is used to determine the target Unity3D business module that matches the target business based on the protocol message of the target business.
[0147] The dispatch module 303 is used to dispatch the protocol message of the target business to the target Unity3D business module to trigger the target Unity3D business module to perform business processing on the target business according to the protocol message of the target business. This business processing includes debugging processing.
[0148] In this embodiment of the invention, the protocol message of the target service includes at least one of the following: the identifier of the target service, the protocol content of the target service, and the storage path corresponding to the target service. The storage path corresponding to the target service is used to store the protocol content of the target service. The identifier of the target service includes the protocol command identifier of the target service and / or the message identifier of the target service. The protocol command identifier of the target service includes, but is not limited to, one or more of the following: model loading identifier, model unloading identifier, and server data identifier.
[0149] The specific methods by which module 303 determines the target Unity3D business module that matches the target business based on the protocol message of the target business include:
[0150] Determine the parameters of the target service, including the quantity and type of the target service;
[0151] When the number of target services is equal to 1, the target Unity3D service module that matches the target service is determined according to the protocol command identifier and type of the target service.
[0152] When the number of target services is greater than 1, the target Unity3D service module that matches the target service is determined based on the protocol command identifier, message identifier and type of each target service.
[0153] It is evident that implementation Figure 4 The described device for joint development and debugging of the Unity3D engine and native client can listen for protocol messages from the native client through a Unity3D service listener built in the Unity3D engine editor environment and dispatch them to the corresponding Unity3D business module for business processing, such as debugging. This eliminates the need to repeatedly embed the Unity3D business module into the native client for repackaging, allowing for consistent runtime results viewed in the Unity3D engine editor environment. Breakpoints and log debugging can be performed in the Unity3D engine environment based on the runtime effects, improving the efficiency and accuracy of joint development and debugging between the Unity3D engine and native client. Furthermore, by selecting appropriate identifiers based on the quantity and type of business messages sent by the native client, and combining this with the business type, the device can accurately and quickly identify the Unity3D business module, especially when the protocol command identifiers of the sent business messages are the same.
[0154] In an optional embodiment, the determining module 302 further determines the parameters of the URL and port to be monitored, the URL and port being used for communication between the first Native client and the Unity3D service listener, the first Native client including the aforementioned target Native client;
[0155] like Figure 5 As shown, Figure 5 This is a schematic diagram of another device for joint debugging based on the Unity3D engine and a native client, as disclosed in an embodiment of the present invention. Figure 5 As shown, the above-mentioned device also includes:
[0156] The 304 configuration module is used to set the URL and port for the Unity3D service listener in the Unity3D engine editor environment, based on the URL and port parameters.
[0157] The listening module 301 is also used to start listening operations on the URL and port after the URL and port are set.
[0158] The 304 setting module is also used in the Unity3D engine editor environment to set the callback method for listening to the protocol messages sent by the first native client, thus completing the setup of the protocol service environment and the Unity3D service listener.
[0159] It is evident that implementation Figure 5 The described device, based on the Unity3D engine and native client integration, pre-builds a protocol service environment and a Unity3D service listener within the Unity3D engine editor environment, taking into account the parameters of the URL and port to be listened to, as well as the callback method for the protocol messages sent by the native client. This enables precise setup of the protocol service environment and the Unity3D service listener, facilitating subsequent listening operations on protocol messages sent from the native client directly within this protocol service environment using the Unity3D service listener.
[0160] In another optional embodiment, the specific method by which the listening module 301 listens for the protocol messages of the target business sent by the target Native client in the established protocol service environment based on the established Unity3D service listener includes:
[0161] Based on the established Unity3D service listener, a connection is established with the target Native client through the URL and port of the established protocol service environment;
[0162] After a successful connection, listen for protocol messages of the target service sent by the target native client. These protocol messages are messages sent by the target native client in a preset file format.
[0163] It is evident that implementation Figure 5 The device described, which is based on the Unity3D engine and the Native client for joint debugging, can also establish a connection with the Native client through the URL and port in the established protocol service environment. After the connection is successful, it can listen to the protocol messages sent by the client, which can improve the accuracy and reliability of protocol message listening, thereby improving the efficiency and accuracy of business processing.
[0164] In yet another alternative embodiment, such as Figure 4 As shown, the above-mentioned device also includes:
[0165] The addition module 305 is used to add the target business protocol message to a pre-determined message queue before the dispatch module 303 dispatches the target business protocol message to the target Unity3D business module to trigger the target Unity3D business module to perform business processing based on the target business protocol message. This message queue is used to store the protocol messages of all businesses sent from the second Native client. The second Native client includes the aforementioned target Native client and other clients. The protocol messages of all businesses include the aforementioned target business protocol message and the protocol messages of other businesses.
[0166] The determination module 302 is also used to determine the message loop mode corresponding to the message queue based on the message status in the message queue;
[0167] Specifically, the dispatch module 303 dispatches the protocol message of the target business to the target Unity3D business module to trigger the target Unity3D business module to perform business processing based on the protocol message of the target business. The specific methods include:
[0168] Based on the message loop approach, the Unity3D-Native client interaction method is invoked to dispatch the target business protocol message to the target Unity3D business module, thereby triggering the target Unity3D business module to perform business processing based on the target business protocol message. This business processing includes debugging.
[0169] It is evident that implementation Figure 5 The described device, based on the Unity3D engine and native client integration, can add protocol messages to a message queue upon detection, and then dispatch them to the corresponding Unity3D business modules for processing in an orderly manner through a message loop. This reduces blocking during protocol message processing, especially when there are too many protocol messages or when multiple protocol messages need to be processed simultaneously, further improving the efficiency of protocol message processing. It also reduces conflicts between the listening thread and the business processing thread, further improving the accuracy and reliability of protocol message processing.
[0170] In yet another alternative embodiment, such as Figure 5 As shown, the above-mentioned device also includes:
[0171] The acquisition module 306 is also used to acquire the current target status in the Unity3D engine editor environment before the addition module 305 adds the protocol message of the target business to the predetermined message queue. The target status includes the message status in the message queue and / or the processing thread status. The message status includes the message data volume and / or message type. The processing thread status includes the status of all threads in the Unity3D engine editor environment, with different threads used to handle different operations.
[0172] The judgment module 307 is used to determine whether the protocol message of the target service meets the predetermined message storage conditions based on the target situation and the content contained in the protocol message of the target service. When the judgment result is yes, the addition module 305 is triggered to perform the above-mentioned operation of adding the protocol message of the target service to the predetermined message queue.
[0173] It is evident that implementation Figure 5 The described device based on the Unity3D engine and native client can also determine whether the protocol message of the business meets the message storage conditions by judging the amount, type and thread processing status of message data in the message queue in the Unity3D engine editor environment, and only add the protocol message to the message queue when the conditions are met. This can improve the accuracy and reliability of the operation of adding protocol messages to the message queue, and further ensure the accuracy and reliability of the business processing of protocol messages.
[0174] Example 4
[0175] Please see Figure 6 , Figure 6 This is a schematic diagram of another device for joint debugging based on the Unity3D engine and a native client, disclosed in an embodiment of the present invention. This device can be applied to scenes containing virtual objects, including virtual characters and / or virtual animals and / or virtual items. The device may include one of a debugging device, a debugging server, a debugging platform, and a debugging system. Also, as... Figure 6 As shown, the device for co-working between the Unity3D engine and the native client may include:
[0176] Memory 401 storing executable program code;
[0177] Processor 402 coupled to memory 401;
[0178] Furthermore, it may also include an input interface 403 and an output interface 404 coupled to the processor 402;
[0179] The processor 402 calls the executable program code stored in the memory 401 to execute some or all of the steps of the method for joint debugging of Unity3D engine and Native client disclosed in Embodiment 1 or Embodiment 2 of the present invention.
[0180] Example 5
[0181] This invention discloses a computer storage medium storing computer instructions. When these computer instructions are invoked, they are used to execute some or all of the steps in the method for joint debugging based on the Unity3D engine and the Native client disclosed in Embodiment 1 or Embodiment 2 of this invention.
[0182] Example 6
[0183] Please see Figure 7 , Figure 7 This invention discloses a joint debugging system for executing some or all of the steps in the joint debugging method based on the Unity3D engine and the Native client disclosed in Embodiment 1 or Embodiment 2 of this invention.
[0184] The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0185] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-Erasable Programmable Read-Only Memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0186] Finally, it should be noted that the method, apparatus, and system for joint debugging based on the Unity3D engine and Native client disclosed in the embodiments of the present invention are merely preferred embodiments of the present invention and are only used to illustrate the technical solutions of the present invention, not to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for joint debugging based on the Unity3D engine and a native client, characterized in that, The method includes: Based on the established Unity3D service listener, the protocol messages of the target business sent by the target Native client are listened to in the established protocol service environment. Both the Unity3D service listener and the protocol service environment are established in the Unity3D engine editor environment. Based on the protocol message of the target service, determine the target Unity3D service module that matches the target service; The protocol message of the target service is dispatched to the target Unity3D service module to trigger the target Unity3D service module to perform service processing on the target service according to the protocol message of the target service. The service processing includes debugging processing.
2. The method for joint debugging based on the Unity3D engine and native client according to claim 1, characterized in that, The method further includes: The parameters of the URL and port to be monitored are determined. The URL and port are used for communication between the first Native client and the Unity3D service listener. The first Native client includes the target Native client. In the Unity3D engine editor environment, the URL and port are set for the Unity3D service listener according to the parameters of the URL and the port. After setting the URL and port, start listening for the URL and port, and in the Unity3D engine editor environment, set the callback method for listening to the protocol messages sent by the first Native client, thus completing the construction of the protocol service environment and the Unity3D service listener.
3. The method for joint debugging based on the Unity3D engine and native client according to claim 2, characterized in that, The built Unity3D service listener listens for protocol messages of the target business sent by the target Native client in the built protocol service environment, including: Based on the established Unity3D service listener, a connection is established with the target Native client through the URL and port of the established protocol service environment; After a successful connection, listen for the protocol messages of the target service sent by the target native client, wherein the protocol messages of the target service are messages sent by the target native client in a preset file format.
4. The method for joint debugging based on the Unity3D engine and the Native client according to any one of claims 1-3, characterized in that, Before dispatching the protocol message of the target service to the target Unity3D service module to trigger the target Unity3D service module to perform service processing on the target service according to the protocol message of the target service, the method further includes: The protocol message of the target service is added to a pre-determined message queue. The message queue is used to store protocol messages of all services sent from the second Native client, which includes the target Native client. The protocol messages of all services include the protocol message of the target service. Based on the message status in the message queue, determine the message loop mode corresponding to the message queue; The step of dispatching the protocol message of the target service to the target Unity3D service module to trigger the target Unity3D service module to perform service processing on the target service according to the protocol message includes: According to the message loop method, the Unity3D-Native client interaction method is invoked to dispatch the protocol message of the target business to the target Unity3D business module, so as to trigger the target Unity3D business module to perform business processing on the target business according to the protocol message of the target business.
5. The method for joint debugging based on the Unity3D engine and the Native client according to claim 4, characterized in that, Before adding the protocol message of the target service to the pre-determined message queue, the method further includes: Obtain the current target status in the Unity3D engine editor environment. The target status includes the message status in the message queue and / or the processing thread status. The message status includes the message data volume and / or message type. The processing thread status includes the status of all threads in the Unity3D engine editor environment. Different threads are used to handle different operations. Based on the target situation and the content contained in the protocol message of the target service, determine whether the target service protocol message meets the predetermined message storage conditions; When the result is determined to be yes, the operation of adding the protocol message of the target service to a pre-determined message queue is triggered.
6. The method for joint debugging based on the Unity3D engine and the Native client according to any one of claims 1-3, characterized in that, The protocol message of the target service includes at least one of the following: the identifier of the target service, the protocol content of the target service, and the storage path corresponding to the target service. The storage path corresponding to the target service is used to store the protocol content of the target service, and the identifier of the target service includes the protocol command identifier of the target service and / or the message identifier of the target service. The protocol command identifier of the target service includes one or more of the following: model loading identifier, model unloading identifier, and server data identifier.
7. The method for joint debugging based on the Unity3D engine and native client according to claim 6, characterized in that, The step of determining the target Unity3D business module that matches the target business based on the protocol message of the target business includes: Parameters for determining the quantity of the target service, wherein the parameters of the target service include the quantity and type of the target service; When the number of the target services is equal to 1, the target Unity3D service module that matches the target service is determined according to the protocol command identifier and type of the target service. When the number of target services is greater than 1, the target Unity3D service module that matches the target service is determined according to the protocol command identifier, message identifier and type of each target service.
8. A device for joint debugging based on the Unity3D engine and a native client, characterized in that, The device includes: The acquisition module is used to acquire the target business protocol message sent by the native client based on the built Unity3D service listener in the built protocol service environment. Both the Unity3D service listener and the protocol service environment are built in the Unity3D engine editor environment. The determination module is used to determine the target Unity3D business module that matches the target business protocol message based on the target business protocol message; The dispatch module is used to dispatch the target business protocol message to the target Unity3D business module to trigger the target Unity3D business module to perform business processing on the target business protocol message, and the business processing includes debugging processing.
9. A device for joint debugging based on the Unity3D engine and a native client, characterized in that, The device includes: Memory containing executable program code; A processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the method for joint debugging based on the Unity3D engine and the Native client as described in any one of claims 1-7.
10. A joint debugging system, characterized in that, The integration system is used to perform the integration method based on the Unity3D engine and the Native client as described in any one of claims 1-7.
Citation Information
Patent Citations
Client security detection method and device based on Android platform Unity3D game
CN107844703A
Program lag positioning method and related device
CN110865940A