I want to implement a chat system like on a phone, but I have absolutely no idea where I should start. My idea is this: a character has a phone with n buttons on the screen. These buttons enable chat with a specific user. I want to make it so that, if I wish, I can send the character several messages from any user at any time in the game and so that the character has the opportunity to choose his answer. However, again, I don’t know where to start…could you give me an idea on how I could make such a system through code?
It will not just be code. It will be user interface design, a lot of UI stuff, some code, and a lot of networking as well as possibly a server, possibly user authentication, possibly security considerations, and possibly platform-specific concerns, such as getting approval for a chat application from Google Play or Apple, as well as any other possible target release platforms.
Otherwise, start with google tutorials.
Hello! Thanks for the answer, but this is not exactly what I’m looking for. My game does not involve multiplayer, and the chat (phone) inside it is just a way to tell the story through other characters.
Like, for example, GTA 5 or maybe Honkai Star Rail
Then it is just UI… start with UI tutorials!
Personally I would use some kind of Layout mechanism, such as a VerticalLayoutGroup.
Within each message you might have a ContentSizeFitter, or perhaps other structuring.
But it’s all just UI, UI, UI, UI. And it will not only be code; there will be prefabs and setup.
You may also find some storytelling assets in the store if your focus is more on telling the story rather than the technical implementation.
Right, it’s all just UI in that case. I could create a fake windows desktop environment and show it on a 3d monitor asset in the game. I could add a panel that represents a window with some content in it. You can show and move the elements around through code and even exchange the text content if things should be dynamical.
That’s actually a really good point… what OP wants might be better fit into a dialog system, and there are a few freebies of those you can integrate out there.
Here’s my dialog system notes:
Dialog system fundamentals and structure:
https://discussions.unity.com/t/807140/2
There are also some free packages you could start from:
Fungus: https://fungusgames.com
Inkle: https://www.inklestudios.com
Even if you don’t end up using either of those, you could review them for structure because it is almost certain that they have already solved all the same problems you are trying to solve.