Forum rules - please read before posting.

Turn Epics Services AC Unlock Achievement into Custom Action List

Hi,

I have a Steam unlock achievement custom action script that works perfectly, I found this one online that is specific for AC, and wondered if you could turn it into a custom action script also so I don't have to haver it as a game object in every scene? My coding skills not the best so I am unable. thanks Chris!

This is the script:

using System;
using System.Collections;
using System.Collections.Generic;

using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

if ENABLE_INPUT_SYSTEM

using UnityEngine.InputSystem;

endif

using Epic.OnlineServices;
using Epic.OnlineServices.Achievements;
using Epic.OnlineServices.Ecom;
using Epic.OnlineServices.UI;
using Epic.OnlineServices.Stats;

using PlayEveryWare.EpicOnlineServices;
using PlayEveryWare.EpicOnlineServices.Samples;

public class EOSUnlockAchievement : MonoBehaviour
{
private EOSAchievementManager achievementManager;
public string achievementID;

private void Awake()
{
    var achievementManager = EOSManager.Instance.GetOrCreateManager<EOSAchievementManager>();
}

public void UnlockAchievement(string achievementID)
{
    achievementManager = EOSManager.Instance.GetOrCreateManager<EOSAchievementManager>();
    achievementManager.UnlockAchievementManually(achievementID);
    Debug.Log("achievement unlocked");
}

}

Comments

  • using UnityEngine;
    using System.Collections.Generic;
    #if UNITY_EDITOR
    using UnityEditor;
    #endif
    using Epic.OnlineServices;
    using Epic.OnlineServices.Achievements;
    using Epic.OnlineServices.Ecom;
    using Epic.OnlineServices.UI;
    using Epic.OnlineServices.Stats;
    
    using PlayEveryWare.EpicOnlineServices;
    using PlayEveryWare.EpicOnlineServices.Samples;
    
    namespace AC
    {
    
        [System.Serializable]
        public class ActionTemplate : Action
        {
    
            public override ActionCategory Category { get { return ActionCategory.Custom; }}
            public override string Title { get { return "Epic achievement"; }}
    
    
            public string achievementID;
    
    
            public override float Run ()
            {
                EOSAchievementManager achievementManager = EOSManager.Instance.GetOrCreateManager<EOSAchievementManager>();
                achievementManager = EOSManager.Instance.GetOrCreateManager<EOSAchievementManager>();
                achievementManager.UnlockAchievementManually(achievementID);
                Debug.Log("achievement unlocked");
                return 0f;
            }
    
    
            #if UNITY_EDITOR
    
            public override void ShowGUI ()
            {
                achievementID = EditorGUILayout.TextField ("Achievement ID:", achievementID);
            }
    
            #endif
    
        }
    
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.