xLua learning summary (4) --- lua visits C#

1. Call the unity log in lua to print hello world:

CS.UnityEngine.Debug.Log("hello world")

2. Create a GameObject in unity through lua

local newGameObj = CS.UnityEngine.GameObject("CreatByLua")
newGameObj.transform.position=CS.UnityEngine.Vector3(1,2,3)

Note: There is no need to use new. According to the above method, you can call the method in Unity to create a game object named CreatByLua in the scene and assign its position.

Guess you like

Origin blog.csdn.net/l17768346260/article/details/103636096