Sample of Chat(GS2 UIKit for Unity)
This sample shows how to create a chat room, register/unregister subscriptions, reflect received messages in the UI, and send messages.
Folder structure
Sample folder :
(Unity project)/Assets/Game Server Services/Samples/UIKit/Gs2Chat/
Sample scene :
(Unity Project)/Assets/Game Server Services/Samples/UIKit/Gs2Chat/Scenes/Chat.unity
This sample relies on the following prefab Fields in the prefab need to be configured.
GS2-Deploy Sample Template:
(Unity project)/Assets/Game Server Services/Samples/UIKit/Gs2Chat/Settings/initialize_chat_template.yaml*.
Create Room
Create a chat room using the Create Room button. Gs2ChatRoomCreateAction prefab is activated (executed) and chat room is created. When the chat room creation is complete, OnCreateRoom of the RoomList component is called and the Room Prefab is instantiated in the ScrollView.
Prefab |
---|
Gs2ChatRoomCreateAction |
Send Message
Send button sends a chat message.
Prefab |
---|
Gs2ChatMessagePostAction |