Stuck on error CS0117

I’ve been stuck on this stupid error for four days can someone help with a solution?

Assets\Scripts\WorldSaveGameManager.cs(34,57): error CS0117: ‘SceneManager’ does not contain a definition for ‘LoadSceneASync’

My Script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

namespace CI
{
public class WorldSaveGameManager : MonoBehaviour
{
public static WorldSaveGameManager instance;

    [SerializeField] int worldSceneIndex = 1;

    private void Awake()
    {
        // THERE CAN ONLY BE ONE INSTANCE OF THIS SCRIPT AT ONE TIME, IF ANOTHER EXISTS, DESTROY IT
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }

    private void Start()
    {
        DontDestroyOnLoad(gameObject);
    }

    public IEnumerator LoadNewGame()
    {
        AsyncOperation loadOperation = SceneManager.LoadSceneASync(worldSceneIndex);

        yield return null;
    }        
}

}

Do you have a script called SceneManager or does any of the assets you use has a script called SceneManager? Try explicitly calling UnityEngine.SceneManagement.SceneManager.LoadSceneASync(worldSceneIndex); in your script, is the error still there?

Also, format you code properly so that it will be easier to read, especially for the number lines to accurately represent the line number in the error, see https://meta.discourse.org/t/selecting-the-programming-language-used-in-code-blocks/19247

i do not have a script called scene manager

Async not ASync. Capitalisation matters, though Visual Studio should be auto-filling things for you if set up properly.

thank you i cant believe i missed this, its unbelievable the amount of times ive spent days on errors just for it to be puncuation or captilization

Sounds like perhaps your IDE isn’t set up properly. Fix that first. Working like that is like trying to build a house by smashing two sharpened rocks together around pieces of wood you find washed up on the beach.

This may help you with intellisense and possibly other Visual Studio integration problems:

Sometimes the fix is as simple as doing Assets → Open C# Project from Unity. Other times it requires more.

Other times it requires you also nuke the userprefs and .vsconfig and other crufty low-value high-hassle files that Visual Studio tends to slowly damage over time, then try the above trick.

Barring all that, move on to other ideas:

Also, try update the package inside of Unity: Window → Package Manager → Search for Visual Studio Editor → Press the Update button

Depending on flavor and version of Visual Studio, it may also have an installation step that you perform within the actual Visual Studio. This step seems finicky at best and may require multiple openings of VS before it comes up.

Update: The VSCode extension has been deprecated and abandoned:

Update: the VSCode integration is back… maybe!?

There may be a community fork available that is receiving updates.

Also, this: No suggestions in Vscode - Unity Engine - Unity Discussions

Recently (July 2023) I worked on a Windows11 system that required a Microsoft component to be installed from within Visual Studio before it would work properly with all the OTHER software installed under Unity. I have no documentation on that process as I have only seen it once and it surprised me as well.

1 Like