𝔐𝔞𝔱𝔱𝔦𝔫
𝔐𝔞𝔱𝔱𝔦𝔫
Explore posts from servers
CC#
Created by 𝔐𝔞𝔱𝔱𝔦𝔫 on 4/1/2024 in #help
Help with DiscordGameSDK in a C# project (no Unity)
I am currently trying to develop a plugin for a Unity game. For this I created a C# project, where I want to use Discord Rich Presence. Here is my main cs file:
using System.Collections;
using System.Collections.Generic;

public class Main : TheGameScript
{
private const ulong CLIENT_ID = 1234567890;
public Discord discord;

public override void Init()
{
var discord = new Discord(CLIENT_ID, (UInt64)Discord.CreateFlags.Default);
var activityManager = discord.GetActivityManager();
var activity = new Discord.Activity
{
State = "Still Testing",
Details = "Bigger Test"
};
activityManager.UpdateActivity(activity, (res) =>
{
if (res == Discord.Result.Ok)
{
Debug.LogError("Everything is fine!");
}
});
}

void Update () {
discord.RunCallbacks();
}
}
using System.Collections;
using System.Collections.Generic;

public class Main : TheGameScript
{
private const ulong CLIENT_ID = 1234567890;
public Discord discord;

public override void Init()
{
var discord = new Discord(CLIENT_ID, (UInt64)Discord.CreateFlags.Default);
var activityManager = discord.GetActivityManager();
var activity = new Discord.Activity
{
State = "Still Testing",
Details = "Bigger Test"
};
activityManager.UpdateActivity(activity, (res) =>
{
if (res == Discord.Result.Ok)
{
Debug.LogError("Everything is fine!");
}
});
}

void Update () {
discord.RunCallbacks();
}
}
I have the five discord_game_sdk.* files within the root of my project directory and added the .cs files for the SDK within a folder called DiscordGameSDK. Somehow I still get the following error:
[CS246]: The type or namespace name `Discord' could not be found. Are you missing an assembly reference? in MyProject/Main.cs at [7, 12]
[CS246]: The type or namespace name `Discord' could not be found. Are you missing an assembly reference? in MyProject/Main.cs at [7, 12]
What am I missing? Any help appreciated :D
46 replies