Scripts

// Config: Engine - [], Toolkit - [v1.0.0]

Demo scripts (this sample, namespace Heathen.DiscordSocialIntegration.TemplateDemo) #

ScriptWhat it isPublic members
DemoNetworkAbstract base for the networking seam.Current (static), IsRunning, StartHost(), StartClient(address), Stop()
PlaceholderNetworkA DemoNetwork that connects to nothing, so the flow runs on one machine. Each place to change is marked NETWORKING.Implements the base members. Inspector: announcedAddress
DemoFlowMoves between menu and session; starts the host; connects members when the host announces.StartSession(), LeaveSession(), OnError. Inspector: session, menu, sessionView, startButton, errorLabel
DemoSessionStageSpawns one capsule per lobby member when the session view is shown and removes them when it is hidden.Inspector: session, followCamera, pawnPrefab, spawnRadius, colors
DemoPawnMoves a capsule with WASD or the arrow keys and Space. Uses the Input System when it is installed, otherwise the legacy Input Manager.None
DemoFollowCameraKeeps the camera behind and above its target.Target
DemoWhitelistThe set of Discord user ids that were in the lobby when the session started.Capture(session), IsAllowed(id), Clear()
DemoSetupCheckDraws a “Setup needed” box while the Application Id is zero.None

Toolkit components the demo uses (namespace Heathen.DiscordSocialIntegration) #

ComponentJob
DiscordConnectionStatusStatus label, Sign in button, optional Sign out button. Refreshes when Discord initialises or the status changes.
DiscordSignInButtonOne button that signs in and out.
DiscordUserData (Foundation)Holds one user and raises onChanged. Tick Local User, call Bind, or let a list bind it.
SetDiscordUserName, SetDiscordUserAvatar, SetDiscordUserStatusShow a user’s name, avatar and status. They follow a DiscordUserData on the same object or a parent.
PersistentDiscordTokenStore (Foundation)The token store the subsystem uses when Remember Sign In is on. AES encrypted in PlayerPrefs with a device-derived key. Obfuscation, not a vault.
DiscordRememberSignInNo longer needed, because the subsystem remembers the sign in. Forget() signs out and clears the saved token.
DiscordUserProfileOne user row: avatar, name, status. useLocalUser makes it show the signed-in player and follow their status.
DiscordStatusPickerDropdown for Online, Idle, Do Not Disturb, Invisible. Shows your current status.
DiscordAddFriendUsername field and button that send a friend request.
DiscordUserListFriends list. Optional grouping into Online and Offline with a header template, and an optional search field (searchField or SearchText) that narrows by name or username. Lists friends only.
DiscordFriendRequestList, DiscordFriendRequestRowReceived or sent requests, with Accept, Decline or Cancel.
DiscordLobbySessionThe lobby. Create, Join(secret), AcceptInvite(invite), Leave, StartSession(address), GetMemberIds; events OnLobbyJoined, OnLobbyLeft, OnMembersChanged, OnSessionStarted, OnError.
DiscordLobbyMemberListMembers of the current lobby; a child named Host is switched on for the host’s row.
DiscordVoiceBarJoin or leave voice, mute, deafen.
DiscordVoiceParticipantList, DiscordVoiceParticipantRowEveryone in the call: speaking light, muted marker, local mute, volume.
DiscordVoiceSettingsPanelMicrophone and speaker pickers, volumes, input mode, noise and echo options.
DiscordVoiceSource, DiscordVoiceRouterPlay a person’s voice through an AudioSource on a GameObject (3D voice). Used when the lobby session’s voice output is Unity Audio.
DiscordVoiceOutputToggleChooses device or Unity audio before joining voice.
DiscordPushToTalkButtonHolds push to talk while pressed.
DiscordLobbyCode, DiscordJoinLobbyCopyable lobby code; join by pasted code.
DiscordInviteButtonInvites the row’s user to the lobby. Disabled outside a lobby, with a tooltip.
DiscordInvitePromptAccept and Decline panel for an invite from a friend.
DiscordTooltipOne shared tooltip shown near the pointer.

The Foundation types behind them (DiscordSocialApp, UserData, LobbyData, the token session) are described in Foundation for Discord Social’s SKILL.md.

Rate This Article!