Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Rich Presence not updated #103

Open
GoldenPalazzo opened this issue Oct 25, 2020 · 3 comments
Open

[BUG] Rich Presence not updated #103

GoldenPalazzo opened this issue Oct 25, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@GoldenPalazzo
Copy link

GoldenPalazzo commented Oct 25, 2020

Describe the bug
Whenever I start my game with this simple script attached to a Node (I'm using Godot Mono), Rich Presence doesn't show up

using Godot;
using System;
using DiscordRPC;
public class RichPresence : Node
{
    public DiscordRpcClient client;

    //[Export]
    public int level = 0;

    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        client = new DiscordRpcClient("761541156173250580");
        //UInt64 unixSeconds = Convert.ToUInt64(DateTimeOffset.Now.ToUnixTimeSeconds());
        //GD.Print(unixSeconds.ToString());
        /*if (level > 0) {
            client.SetPresence(new DiscordRPC.RichPresence()
            {
                Details = "Level 1-"+level.ToString(),
                State = "Singleplayer",
                //Timestamps = unixSeconds,
                Assets = new Assets() {
                    LargeImageKey = "gamejoltbannersquare",
                    LargeImageText = "Best videogioco ever"
                }
            });
        } else {*/
            client.SetPresence(new DiscordRPC.RichPresence()
            {
                Details = "Idling",
                //Timestamps = unixSeconds,
                Assets = new Assets() {
                    LargeImageKey = "gamejoltbannersquare",
                    LargeImageText = "Best videogioco ever"
                }
            });
        //}
        client.Initialize();
    }
//  // Called every frame. 'delta' is the elapsed time since the previous frame.
//  public override void _Process(float delta)
//  {
//      
//  }
}

To Reproduce
Steps to reproduce the behavior:

  1. Create a Node
  2. Attach the script below
  3. Build and run the project

Expected behavior
My discord status should show up.

Desktop (please complete the following information):

  • OS: Windows 10 Pro
  • Framework: .NET 4.0
  • Version: 1.0.150
@GoldenPalazzo GoldenPalazzo added the bug Something isn't working label Oct 25, 2020
@Lachee
Copy link
Owner

Lachee commented Oct 27, 2020

If you are using Mono, you will need to use the native pipe wrapper that is used in the Unity version.

@GoldenPalazzo
Copy link
Author

How? I checked your other repo, built it with Visual Studio code and tried to import in my project's .csproj like this

<Project Sdk="Godot.NET.Sdk/3.2.3">
  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
    <RootNamespace>IndustrialRun</RootNamespace>
  </PropertyGroup>
  <ItemGroup>
  <!-- My Libraries -->
  <PackageReference Include="Newtonsoft.Json">
    <Version>12.0.3</Version>
  </PackageReference>
  <Reference Include="UnityNamedPipe">
    <Private>False</Private>
    <HintPath>$(ProjectDir)/lib/UnityNamedPipe.dll</HintPath>
  </Reference>
  <PackageReference Include="DiscordRichPresence">
    <Version>1.0.147</Version>
  </PackageReference>
  </ItemGroup>
</Project>

But then when I write
using UnityNamedPipe;
VS Code tells me that the namespace hasn't been found.

I'm not very familiar with C#, I'm using it just because this is the only way to use Rich Presence in Godot.

@sitiom
Copy link

sitiom commented Sep 19, 2022

Duplicate of #94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants