AddPersistentListener - substitude when building the game

Hi there,
I use UnityEventTools.AddPersistentListener to add listeners when building my game levels. However, when the time comes to build the game, it seems UnityEventTools is part from UnityEditor.Events
My question is - how can I use AddPersistentListener to add listeners for game built?

Just use AddListener instead. Alternatively save out the scenes on build.

Thanks, @Kiwasi - actually, the only code change I did was to add preprocessor directive #if UNITY_EDITOR inside the script. Since in editor mode all required listeners are created and serialized, they can be used later on, when the game is built.