Skip to content
New issue

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

资源管理模块问题(A依赖于B,A对B持有引用) #38

Open
bigbigfun opened this issue Nov 27, 2018 · 1 comment
Open

资源管理模块问题(A依赖于B,A对B持有引用) #38

bigbigfun opened this issue Nov 27, 2018 · 1 comment

Comments

@bigbigfun
Copy link

加载逻辑中:加载BundleA时发现 A依赖于B,A对B持有引用,则对B引用计数加1,但如果存在多级依赖,比如一个Prefab A依赖一个材质 B,材质 B依赖一张贴图 C,ABC都是单独打成Bundle, A依赖于B和C,加载A时B、C的计数都会加1,但实际上B依赖于C,C被A,B引用,引用计数应该是2

image

@smilehao
Copy link
Owner

smilehao commented Jan 9, 2019

这个地方不需要管直接引用还是间接引用,A依赖于B,B依赖于C,那么A依赖于B、C,不需要管B于C之间的关系,加载的时候只要保证A、B、C都加载出来,A就没问题了;如果A在异步加载的同时也加载了D,而D也依赖于C,那么C的引用计数会变成2,此时A加载完毕,A、B由于引用计数归0而被卸载(假设非常驻资源),C会由于引用计数为1而保留,这个时候D依然能正确被加载出来。我的分析没有错误吧?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants