Question about system messages and message quenue


I post two messages.
1)Message to go inside proxy.
2)Message to disable proxy.
My go not received message 1. Looks like it already disabled.
If i comment 2 message i receive 1 message in go.

Is system messages, works before all other messages?, HASHES.MSG_SAVE_STATE, {id = 1}), HASHES.MSG_DISABLE)


Hmm, yeah, not sure of the details of our message passing system. @Mathias_Westerdahl, @Johan_Beck-Noren or @sven knows more.


I tried to reproduce this locally without success. :frowning:

This is my setup;

function init(self)".", "acquire_input_focus")"#collectionproxy", "load")

function on_message(self, message_id, message, sender)
	if message_id == hash("proxy_loaded") then, "enable")

function on_input(self, action_id, action)
	if action_id == hash("touch") and action.released then"proxy:/go#proxy", "do_something")"main:/main#collectionproxy", "disable")
  • proxy.script
function on_message(self, message_id, message, sender)

And this is the output I’m getting when I click (bound to hash("touch")):

INFO:DLIB: Log server started on port 57805
INFO:ENGINE: Engine service started on port 57806
INFO:ENGINE: Defold Engine 1.2.123 (46d8b7e)
INFO:ENGINE: Loading data from: build/default
INFO:ENGINE: Initialised sound device 'default'
DEBUG:SCRIPT: hash: [do_something]

Does this roughly correspond to your setup? Am I missing something?


Looks as my. I will try reproduce it in new project. Maybe i am doing something else :thinking:


I make a simple example.All work.
I will continue investigation.


I have no ideas. Is unload msg handle as all other messages?
In test project, this work."proxy:/gui#gui_test_proxy", "do_something")"/scenes#collectionproxy", "disable")"/scenes#collectionproxy", "unload")"/scenes#collectionproxy", "async_load")

But same code in my project not work. But if delete unload and async_load. All ok.

#7"/scenes#collectionproxy", “disable”)"/scenes#collectionproxy", “unload”)“proxy:/gui#gui_test_proxy”, “do_something”)

go will receive do_something message. So all should work


I think both disable and unload will be handled at the very end of the frame, so “do_something” will arrive since it’s being sent the same frame.


Ok.So why message can be disappeared?=)
Go not receive message, only if it not existed or disabled in previous frame, right? But if go not exist i will get error in log. But i don’t have any errors


I’m not 100% sure of your setup, but;

  • If you send both a “disable” message and another regular message the same frame, both of these will be received.

  • If you send both a “disable” and a “unload” message, plus another regular message the same frame, all of these will be received.

  • If you send a “disable” message one frame, then a regular message the frame after, the regular message will be queued and processed next time the collection proxy is enabled.

  • If you send a “disable” and a “unload” message one frame, then a regular message the frame after you will get an error since the proxy will no longer be loaded.


I found problem.
Send message “start_unload_proxy” to go.
Then when go received that message.Try send msg then disable. Your go will not receive do_something msg."proxy:/gui#gui_test_proxy", "do_something")"/scenes#collectionproxy", "disable")"/scenes#collectionproxy", "unload")



@sven ?


Any idea?


It’s not really clear what you wish to do. It feels kinda dangerous to be so reliant on this behaviour where messages are posted to a collection the same instance that it is unloaded or disabled. Can you create a minimal example and share it?


I don’t think it is dangerous to post msg to go inside proxy then post unload to proxy. It is message queue, they should execute one after other.
My use case.
1)In any go i can call change scene method.
2)Message to change scene will be send to some msg proxy on main collection. I need this msg proxy to get proxy_loaded messages, and transition done message.
3)This proxy send show_out msg to scene1://controller
4)scene1://controller received show_out message and start show out animation
5)when animation done. It send to main://msg_proxy transition_done msg.
6)main://msg_proxy received transition_done msg. Send 2 messages.

  • scene1://controller save_state
  • main://scene_1#collection_proxy unload

The problem, that scene1 not received message save_state.
Looks like scene_1 unloaded. But if it unload i should get error in log. I don’t have any warning or error in logs, but msg save_state is missed.
So i don’t understand what is happened.

I share one simple example up.