Unity - Brick Log - How ToLua blocks wrapper files from generating corresponding members (methods, fields) - NoToLuaAttribute

The method is very simple: as long as we search for VS: the string of Lua/Generate All, and then follow the logic of the past, we can find the following code

IsObsolete Chinese meaning: Is it expired; Is it abandoned;

Although the meaning is not suitable, it is good to make do to achieve the same functional effect

I personally think that for these common functions, ToLua authors should write down the instructions (ReadMe.md) NoToLuaAttribute on the home page of the github repository, which will be much more user-friendly.
insert image description here


How to use, it's very simple:

public class TestClass
{
    
    
	// 默认都会被 wrapper
	public float inWrapperField;
	public void InWrapperFunc() {
    
    }
	// 不想被 wrapper 那就加 Attribute
	[NoToLua] // NoToLuaAttribute 的简写 c#.net 的语法糖可省去 Attribute
	public float thisIsIgnoreField;
	[NoToLua]
	public void ThisIsIgnoreFunc() {
    
    }
	
}

In this way, the and members in the above TestClassclass will not be wrapped by ToLua topublic float thisIsIgnoreField;public void ThisIsIgnoreFunc() {}

Guess you like

Origin blog.csdn.net/linjf520/article/details/122068129
Recommended