On CheckEnvironment() return
APIAddon_Preload
instead of
APIAddon_Normal
. This will load all three functions (CheckEnvironment(), RegisterInterface(), Initialize()) during startup of AC instead of the usual two (CheckEnvironment() and RegisterInterface()).
IanTr wrote:
We've tried calling ACAPI_Notify_CatchProjectEvent within the RegisterInterface function, but it returns the error APIERR_REFUSEDCMD.
There are functions that are not usable in CheckEnvironment() or RegisterInterface(), thats why they return
APIERR_REFUSEDCMD
. I'm guessing since these functions start when the project haven't fully loaded yet it won't have any project events to catch.
Initialize() can handle
ACAPI_Notify_CatchProjectEvent
(docu says so), but I'm not sure about other functions like ACAPI_Database or ACAPI_Environment.
Also don't forget to use
ACAPI_KeepInMemory(true)
else it might unload the addon at the wrong time.