玩设计-场景概念冬季班
thread.Join();
var anyClassForGCHandle = new AnyClass();
var gcHandle = GCHandle.Alloc(anyClassForGCHandle);
}
private static void AnotherThread() {
var anyClassLocal = new AnyClass();
}
}
在构建设置中打开“Development Build”,并且在“Run in Xcode”中将值设置成“Debug”。在生成的Xcode项目中,首先搜索字符串“Start_m”。你应该能找到为HelloWorld类中Start函数生成的HelloWorld_Start_m3原生代码函数。
将线程中的局部变量添加成为“根”对象
在HelloWorld_Start_m3中的Thread_Start_m9处添加一个断点。这个函数会创建一个新的托管线程,因此这个线程会当成“根”对象被添加到GC中。我们能在随Unity一起发布的libil2cpp的头文件中一探究竟。在Unity的安装