getnamo / GlobalEventSystem-Unreal

Loosely coupled internal event system plugin for the Unreal Engine.
MIT License
270 stars 43 forks source link

Event listener skipped due to function not having matching parameters #21

Closed reisandbeans closed 2 years ago

reisandbeans commented 2 years ago

Hello! I'm trying to use the event system to notify different areas of my game that a quest has been completed. My quests extend UDataAsset and are defined in C++. Once it completes, I can successfully emit an event from the quest, but I'd like to pass the quest itself as a parameter.

I created a simple listener in my ThirdPersonCharacter to simply print the title of the completed quest. I added a function to handle that in my character blueprint, and declared a paremeter of the type Quest. I can see that the listener is triggered, but my handling function is not called and I get the following error:

FGESHandler::EmitEvent quest.Questcomplete skipped listener ThirdPersonCharacter_167:OnQuestComplete due to function not having a matching NumericProperty signature.

That tells me that I'm clearly doing something wrong, but I fail to see what. Can you please help?

reisandbeans commented 2 years ago

I was doing some debugging and noticed that if replace FNumericProperty with FObjectPropertyBase in here it seems to work, but since I'm a begginer in c++/unreal, I might be completely off

getnamo commented 2 years ago

Can you show both the emitter and listener example code? The log warning suggest type mismatch. If you're emitting a UObject you should be listening with an Object type. Optionally you could use FGESWildcard property structure and decode it

e.g. it seems you're doing https://github.com/getnamo/global-event-system-ue4#uobject and should receive it with https://github.com/getnamo/global-event-system-ue4#uobject-param-event

getnamo commented 2 years ago

Hmm https://github.com/getnamo/global-event-system-ue4/blob/master/Source/GlobalEventSystem/Private/GESHandler.cpp#L708 that does seem like a bug at a glance

getnamo commented 2 years ago

Let me know if you run into any bugs with your suggested fix: https://github.com/getnamo/global-event-system-ue4/commit/5cbcaca413459f702f3135f03a9b7e519e8f71d5

reisandbeans commented 2 years ago

@getnamo so far I haven't observed any bug related to that and it seems to work pretty well