We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
static bool ObjectValidCheck(object obj) { return (!(obj is UnityEngine.Object)) || ((obj as UnityEngine.Object) != null); } 上面接口会每帧检查非UnityObject,进行销毁。如果非UnityObject对象,比如List的话,只能通过lua层置空,然后等C#的collectObject去销毁吗?能不能也有类似的检查方式去处理
The text was updated successfully, but these errors were encountered:
你这个接口,没看出来你指的什么“销毁”? 看似你写的只是与这个相同的功能 有的Unity对象,在C#为null..
我觉得你误解了销毁指的是 UnityObject.Destroy 还是 collect。 Destroy后的obj,这个obj访问时在C#中仍然是有对象值的,而不是单纯的null,是无法再次在引擎中使用的错误对象。终究还是要置空等collect。 这样的对象 在lua中如果写:
if obj then -- 这里就会true,里面使用他就会出现异常 ... end
Sorry, something went wrong.
你没搞清楚这段代码的意思。 从C#语言的角度,就是没引用就释放。 UnityEngine.Object及其派生类有个特殊的状态:Destroyed,这段代码是加快这种状态对象的释放。
No branches or pull requests
static bool ObjectValidCheck(object obj)
{
return (!(obj is UnityEngine.Object)) || ((obj as UnityEngine.Object) != null);
}
上面接口会每帧检查非UnityObject,进行销毁。如果非UnityObject对象,比如List的话,只能通过lua层置空,然后等C#的collectObject去销毁吗?能不能也有类似的检查方式去处理
The text was updated successfully, but these errors were encountered: