Reason behind SendMonoMessage?
Was doing an optimization pass on a scene we're preparing for our game when I discovered that SendMonoMessage() was allocating 7.1mb of memory each time it was called. I do realize the reason for the poor performance is due to the sheer scale of the scene that we're dealing with (20,000~ LOD objects). Still, why not target PhotonView game objects + MonoBehaviours that must be manually registered with Photon in order to receive MonoMessages?
Or maybe I'm completely missing something here...?
Or maybe I'm completely missing something here...?
0
Comments
That might be related to the un-cached use of FindObjectsOfType.
Actually, that is slow to begin with.
The idea of registering the GOs that get updates is definitely interesting. At least, if those objects would register automatically for updates (through a component or so).
I am not so sure how fast I can implement something that's useful for you. I have to make sure it doesn't break stuff and release and such...
But I think you could modify the code accordingly in SendMonoMessage. Add a Dictionary of GOs that want callbacks and make them register (by adding themselves to it). As fallback (if the Dictionary is empty), find the GOs as done now.
Anyways. Good point. Thanks for the heads up!
Then to register we've just got:
Seems to work well for us!
*Edit: Just saw that you suggested doing almost exactly what I posted :P
Does it matter that you only call SendMessage only once per GO?
This way, you won't have to keep your updates and it's easier for others to get the same improvement.
Should be out next week.