steamworks를 unity에서 더 쉽게 사용할수 있도록 만들어진 라이브러리
https://github.com/Facepunch/Facepunch.Steamworks
GitHub - Facepunch/Facepunch.Steamworks: Another fucking c# Steamworks implementation
Another fucking c# Steamworks implementation. Contribute to Facepunch/Facepunch.Steamworks development by creating an account on GitHub.
github.com
git clone
visual studio에서 솔루션 열기
솔루션 빌드
\Facepunch.Steamworks\Facepunch.Steamworks\bin\Debug\net46
내용물 복사
\Facepunch.Steamworks\UnityPlugin
안에 붙여넣기
steam_api.dll 이랑
steam_api64.dll 은 빼는 게 좋겠다
redistributable_bin 경로안에 같은 이름이 또 있음
유니티 프로젝트 생성
유니티 assets 폴더에 UnityPlugin 끌어 놓기
스크립트 생성
using Steamworks;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SteamManager : MonoBehaviour
{
public uint appId;
private void Awake()
{
DontDestroyOnLoad(this);
try
{
Steamworks.SteamClient.Init(appId, true);
Debug.Log($"Steam is up and running. {SteamClient.Name}"); // 내 닉넴
foreach (var friend in SteamFriends.GetFriends())
{
if(friend.IsOnline)
{
Debug.Log($"{friend.Name}"); // 온라인인 친구 닉넴
}
}
}
catch(System.Exception e)
{
Debug.Log(e.Message);
}
}
private void OnApplicationQuit()
{
try
{
Steamworks.SteamClient.Shutdown();
}
catch(System.Exception e)
{
}
}
}
빈오브젝트 생성하고 스크립트 인스펙터어 끌어 놓은다음 실행
내 닉넴 DA랑 온라인인 친구 닉넴 출력 됨