Strategy for Game App-UI communication?

Hi guys!
Parallel to the other thread I had open a while ago I would like to know what strategies you guys think are better to establish the communication between the game application and the UI in terms of optimization, performance, decoupling of classes… like events or any other you can think of.

Thank you very much in advance!

The best way is always the first and easiest method that you can implement and finish and ship.

Otherwise, these completely and totally generic ‘what is the best way’ questions, which come up at least three or five times per week, are akin to asking “how many angels can dance on the head of a pin?” or “what is the sound of one hand clapping?”

The reason: if you’re making the Flappy Birds menu system the answer will be one thing.

If you’re making the World Of Warcraft UI the answer will be quite different.

A better way to move the conversation forward is to say something along the lines of:

“I am presently using technique XYZ to couple UI with my GameApp. This technique works great for A,B, and C, but I find it is very tedious to do D, E and F. Does anyone have suggestions on how to make D,E and F easier while still keeping A, B and C easy too?”

1 Like

Yes… I just realized reading you that maybe this is not the best way to pose my question… sorry.

Let me ask this another way then! Since I do not have much experience in game development, what strategies are there for establishing communication between the game application and the UI? I’ve been looking into this for some time now, but I’m not able to get something that works properly for me…

PS: I have edited the title to avoid any confusion!

The first strategy is to use Unity to hook up buttons through the UGUI stuff right in the editor. It has the important advantage that 100% of Unity users going forward will understand what you did. It has the additional advantage that it is likely to play well with any future packages or other stuff you may add to the game. Not only that, it’s pretty simple to do simple stuff.

Another way might be to write your own abstraction layer between the UI and your game. I did this with my Datasacks package, which I find handy for my way of thinking. It is extremely simple and lightweight as far as what it does, but it might or might not appeal to you.

Beyond that there are plenty of other approaches you can read about online, both related to Unity and related to gamedev in general.

But reading about approaches to software engineering challenges is NOT the same thing as using them “for reals” to solve your real problems, and understanding if they confer any advantage to you at all, or if they simply move the lump in the carpet to another part of the room and there is still a lump in the carpet.

8687265--1171653--20180724_datasacks_overview.png

Datasacks is presently hosted at these locations:

https://bitbucket.org/kurtdekker/datasacks

https://github.com/kurtdekker/datasacks

https://gitlab.com/kurtdekker/datasacks

https://sourceforge.net/projects/datasacks/

If you are using any version of Unity later than Unity2021, it may be necessary to add this line to your Packages/manifest.json, or add it via the Package Mangler:

“com.unity.ugui”: “1.0.0”,

1 Like