risk-of-thunder / R2API

A modding API for Risk of Rain 2
https://thunderstore.io/package/tristanmcpherson/R2API/
MIT License
134 stars 55 forks source link

Small cyclic dependency edge case with the R2API core #483

Open xiaoxiao921 opened 1 year ago

xiaoxiao921 commented 1 year ago

most modules have a package ref csproj dependency on r2api.core, but no attribute bepindependency on it, meaning that potentially the logger (only this so far) could be used (through on the of public methods for example) while the Awake() still not being fired, leading to exceptions

a solution to this if i'm not mistaken would just be to move the logger to a r2apicore baseunityplugin class and have the r2api baseunityplugin depends on it, while making sure the r2api submodules which depends on Core have a bepindependency on it

the modules can't have a bepindependency on r2api baseunityplugin as this one already happens to have soft dependencies to most of them, due to it being the r2api.legacy baseunityplugin