I have several BT Assets containing subBT (as assets). For performance reason, we use a pool where I instantiate my monsters (with their BT).
Unfortunatly, the subBT are not loaded at the same time as the root tree but only when needed. Looks a good idea on the paper but it does not work this way, the subBT loading is way too expensive to occur in runtime. I am looking for a way to load a BT and all its subBT at the same moment (when I show a progress bar and before returning the prepared monster to the pool). I had a look at OwnerGraph.Initialize and tried to invoke CheckInstance() on all its SubTree nodes at the end of OwnerGraph.Initialize but SubTree.subTree is not the same as when it is really executed (so I load the subtree twice : when I want and… when it is executed :/ )
Hello and sorry for the late reply due to Eastern!
Indeed. That is because the “currentInstance” field (in SubTree.cs), is only set in the SubTree.OnExecute method rather than in it’s CheckInstance method. A temporary (and rather dirty fix) for this would be to:
– Open SubTree.cs and right before the return instance; at the end of the before, also set currentInstance = instance;.
– Keep your changes in GraphOwner.Initialize thus invoking CheckInstance() as you already do.
Having said that, I do plan to of course properly implement pre-initialization for the next version, that will be done with an option in the GraphOwner inspector by the way, so the above solution is only temporary one :).
Ok thanks, I’ll give it a try. As I am not fond of dirty fixes (and as I want to keep your framework as clean as it is), have you any idea of the release date of your next version including the “prewarm” ?
I will send a new version to the asset store in the next coming days, but unfortunately this feature “prewarm”, will not make it to this version (because I have already delayed the new version), so it will appear on the version right next after this one.
So, please do the “dirty fix” I’ve send you until your requested feature is implemented properly and once you update, it will be easy to move on the the “official” way of doing this (with the option in the inspector).
I am currently working on a big update (both performance and features) and a proper “fix” will be part of this. The previous “dirty fix” is still applicable but a more clean way, would be to simply add this code in SubTree.cs:
Hi, is there an ETA for the proper “prewarm” toggle? We just upgraded to on 2.9.7 and were wondering if we should apply the fix above or just wait for the clean solution.