Different behavior in Editor vs Build
See original GitHub issueHello, I was attempting to write my own solution, stumbled upon this project which does exactly what I was trying to make, so am seeing if I can just use this instead. In both my own solution and yours I am noticing different behavior in the editor vs on a build (Android).
I have a MonoBehaviour class, Damageable
. This script exists on my enemy prefabs, which I am loading via an Addressable AssetReference
and spawning with an ObjectPool
. It has a reference to a DamageableScriptableEvent
instance that exists in the project. I have a DamageableScriptableEventListener
(created with the wizard) that exists in the scene and is loaded with the scene. When a Damageable
is instantiated and then enabled, my intention is to Raise the DamageableScriptableEvent and have a listener that spawns health bars on the canvas. All of this is working great in the Editor.
However on a build, I am noticing that while the event is getting raised, my listener (which exists in the scene and is loaded with the scene) simply ignores the event on a build. This is not the same behavior in the editor, where the event is listened to and the health bar is spawned. I’ve noticed that when an event raiser/listener pair is loaded in the scene, everything works as expected on a build, but if the event raiser is an instance of a loaded prefab, the listener only receives the callback in the editor. Is this expected behavior? Is there a good solution for this situation? Is this just how ScriptableObjects work?
Thanks!
Issue Analytics
- State:
- Created 4 months ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Addendum: in the repo above I added a workaround for this issue, which is to mark the ScriptableEvent as addressable as well as load the scene via addressables. Hopefully it’s useful for whoever might stumble across this problem with your repo!
That thread is very helpful, thank you!