cneicy / cneicy.github.io

Blog
0 stars 0 forks source link

crash-2024-02-14_23.46.39-fml #7

Open utterances-bot opened 7 months ago

utterances-bot commented 7 months ago

从MonoBehavior不允许使用new了解Unity的继承关系

MonoBehavior下gameObject不能为static则导致抽象工厂继承自MonoBehavior的话不被允许使用new关键字传递对象。 浅显一点的原因是MonoBehavior继承自Component,所以传递的也被规定为Component。 但是Unity给我们留下了口子。 感谢CSDN大佬( https://blog.csdn.net/woodengm/article/detail

https://cneicy.github.io/crash-2024-02-14_23.46.39-fml.htm

cneicy commented 7 months ago

翻了一下ScriptableObject的unity文档,这东西用处还挺多(:з」∠)