Forum rules - please read before posting.

Error on StopWalking Script since updating AC

HI I just updated to AC1.79.3 and I now get this error for my script

Assets/TMOWM/Scripts/OnLoadStopWalk.cs(13,44): error CS0123: No overload for 'StopWalking' matches delegate 'EventManager.Delegate_SaveID'

This is the script, can you help?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using AC;

public class OnLoadStopWalk : MonoBehaviour
{
    List<AC.PlayerPrefab> players;

    // Start is called before the first frame update
    void Start()
    {
        AC.EventManager.OnFinishLoading += StopWalking;
        AC.EventManager.OnAfterChangeScene += StopWalking;
    }

    private void StopWalking()
    {

        players = AC.KickStarter.settingsManager.players;

        foreach (AC.PlayerPrefab currentplayerPrefab in players)
        {
            AC.Player currentplayer = currentplayerPrefab.GetSceneInstance();
            if (currentplayer)
            {
                currentplayer.Halt();

            }
        }

        AC.KickStarter.player.Halt();
    }

    private void StopWalking(AC.LoadingGame loadingGame)
    {

        StopWalking();
    }

    // Update is called once per frame
    void Update()
    {

    }
}

Comments

  • The OnFinishLoading event now requires an integer parameter, assigned as the save file's ID number.

    You should also unregister events in OnDisable:

    using System.Collections.Generic;
    using UnityEngine;
    using AC;
    
    public class OnLoadStopWalk : MonoBehaviour
    {
        List<AC.PlayerPrefab> players;
    
        void OnEnable()
        {
            AC.EventManager.OnFinishLoading += OnFinishLoading;
            AC.EventManager.OnAfterChangeScene += StopWalking;
        }
    
        void OnDisable()
        {
            AC.EventManager.OnFinishLoading -= OnFinishLoading;
            AC.EventManager.OnAfterChangeScene -= StopWalking;
        }
    
        void OnFinishLoading (int saveID)
        {
            StopWalking ();
        }
    
        private void StopWalking()
        {
            players = AC.KickStarter.settingsManager.players;
    
            foreach (AC.PlayerPrefab currentplayerPrefab in players)
            {
                AC.Player currentplayer = currentplayerPrefab.GetSceneInstance();
                if (currentplayer)
                {
                    currentplayer.Halt();
    
                }
            }
    
            AC.KickStarter.player.Halt();
        }
    
        private void StopWalking(AC.LoadingGame loadingGame)
        {
            StopWalking();
        }
    }
    
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.