Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Data interaction method between Lua language and Unity

A data interaction and language technology, applied in the field of data interaction, can solve problems such as game performance impact and cumbersome development process, and achieve the effects of simplifying variable declaration and use process, convenient support, and convenient use

Active Publication Date: 2021-03-30
厦门极致互动网络技术股份有限公司
View PDF3 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Unlike the C# language natively supported by the Unity engine, Unity does not provide variable binding support for the Lua language, including Lua variable identification, editing, storage, and use processes. In game development, Lua language interacts with Unity objects and components. You can only call the C# interface "Find" (query) and "GetComponent" (get object) provided by Unity to get objects or components, which makes the development process cumbersome, and game performance will also be affected during frequent object calls

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Data interaction method between Lua language and Unity

Examples

Experimental program
Comparison scheme
Effect test

Embodiment

[0026] like figure 1 As shown, a data interaction method between Lua language and Unity includes the following steps:

[0027] S1. Define the type of Lua variables: define the type of Lua local variables in a named manner, and convert them into fixed-format Lua codes, and write the Lua codes into C# mounted on the corresponding Unity scene or prefab In the Lua script file on the mediation component;

[0028] For example: for the Lua variable "_goTest" (execution test), when it is defined as Unity's GameObject (game object) type, the Lua code definition is declared as:

[0029] Comment code: ---@typeGameObject@_goTest;

[0030] Variable declaration: local_goTest=bind._goTest;

[0031] In this way, the Lua variable "_goTest" without any type is artificially defined as the GameObject (game object) type, and the object name of the GameObject type needs to start with "_go" for subsequent identification. Similarly, for common types in Unity such as: Materail (material), Transfor...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a data interaction method between Lua language and Unity, which comprises the following steps: S1, defining the type of a Lua variable, converting the Lua variable into a Lua code in a fixed format, and writing the Lua code into a Lua script file mounted on a C# intermediary component; S2, automatically assigning values to Lua variables, and storing the Lua variables into adata container in the C# intermediary component; S3, automatically serializing the data in the data container; S4, by the C# intermediary component, deserializing all the serialized data collected inthe data container and assembling the serialized data into a LuaTable type variable which can be recognized by a Lua language; and S5, by the C# intermediary component, initializing the Lua script file, and transmitting the LuaTable type variable to the Lua script file for use of the transmitted variable. According to the method, data interaction between Lua and Unity is realized through the C# intermediary component, variable declaration and use processes of the Lua language are greatly simplified, and meanwhile, the game performance of the Lua language when the Unity object is used is improved.

Description

technical field [0001] The invention relates to the field of computer technology, in particular to a data interaction method between Lua language and Unity. Background technique [0002] Unity engine game hot update is an important technology for online games on mobile platforms. The existing Unity game engine provides the C# language to interact with Unity objects: C# declares variables, drags and binds or edits objects under the Unity editor. Unlike the C# language natively supported by the Unity engine, Unity does not provide variable binding support for the Lua language, including Lua variable identification, editing, storage, and use processes. In game development, Lua language interacts with Unity objects and components. You can only call the C# interface "Find" (query) and "GetComponent" (get object) provided by Unity to obtain objects or components, which makes the development process cumbersome, and game performance will also be affected during frequent object calls...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F8/30G06F8/41A63F13/77
CPCG06F8/31G06F8/427A63F13/77A63F2300/5526
Inventor 梁超汪兴
Owner 厦门极致互动网络技术股份有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products