rlabrecque / Steamworks.NET

Steamworks wrapper for Unity / C#
http://steamworks.github.io
MIT License
2.84k stars 369 forks source link

The name 'SteamManager' does not exist in the current context #642

Open ChurikiTenna opened 3 months ago

ChurikiTenna commented 3 months ago

I have installed Steamworks through Package Manager, and using namespace seems working fine. However, when I try to use SteamManager according to GettingStarted, it fails with this error:

The name 'SteamManager' does not exist in the current context

Code

#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
using Steamworks;
#endif
...
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
        Debug.Log($"Steamworks.Version {new Steamworks.CGameID()}");//this works
        if(SteamManager.Initialized) {// this does not work.
            string name = SteamFriends.GetPersonaName();
            Debug.Log(name);
        }
        #endif

Running on Mac(Apple Silicon).

rlabrecque commented 3 months ago

I think you need to pull down https://github.com/rlabrecque/Steamworks.NET-SteamManager/ into your project separately currently. It's not inside the package manager version because it's supposed to be the starting point for your own code. There's a ticket around here somewhere to make this more-automatic; which is highly needed.

I'm going to leave this ticket open primarily to improve the documentation

JamesMcGhee commented 23 hours ago

In general, I would say don't use SteamManager rather use it as a starting point to write your own.

Out of the box it makes some assumptions understandably being an informative bit of a sample

In particular "SteamManager.cs" gets unfortunately packed into a lot of things from UAS or examples you will find on YouTube or what have you so tends to create a little catastrophe here and there :)

not the fault of the script but rather people's abuses of it ;)

@rlabrecque we tend to mark our informational sample scripts with

[Obsolete("This script is for demonstration purposes only and is not intended for production use!")]

Or similar ... that will cause Unity to render a highlighted note about it being "deprecated" and draw the user's attention to that fact. It will still compile and work of course it will just throw a warning for them to be aware of image