记录找了一天的bug:The object of type ‘GameObject’ has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object.
unity 切换场景的时候总是报错,说是某个类在尝试调用已经销毁的某个东西。
错误原因:在设置这个类单例的时候顺手加了个DontDestroyOnLoad(this);
(摔)
第一次用单例,顺便记一下:unity切换场景时所有前场景的东西都会销毁掉,设置dontdestroy,可以把前一个场景的这个物体弄进下一个场景。