0
votes

I imported a project from an earlier version Unity, I'm currently using 2018.3

I got one Issue, I can't seem to ignore It, commenting it gives me another error

Assets\Scripts\Generals\LoadController.cs(48,22): error CS0117: 'SceneManager' does not contain a definition for 'LoadSceneAsync'

I do not have a defined class named 'SceneManager' that's overriding the unity SceneManager Class

LoadController.cs

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

 public string nameSceneLoad = "MainGame";
 void NextScene()
{
    CancelInvoke();
    SceneManager.LoadSceneAsync (nameSceneLoad, LoadSceneMode.Single);
}

If I try to ignore It I'll have the following

Assets\Photon Unity Networking\Editor\PhotonNetwork\PhotonViewHandler.cs(188,13): error CS0433: The type 'EditorSceneManager' exists in both 'Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'

PhotonViewHandler.cs

//TODO: check if this can be internal protected (as source in editor AND as 
dll)
public static void LoadAllScenesToFix()
{
string[] scenes = System.IO.Directory.GetFiles(".", "*.unity", 
SearchOption.AllDirectories);

foreach (string scene in scenes)
{
EditorSceneManager.OpenScene(scene);
PhotonViewHandler.HierarchyChange();//NOTE: most likely on load also 
triggers a hierarchy change
EditorSceneManager.SaveOpenScenes();
}
Debug.Log("Corrected scene views where needed.");
}

Screan Any ideas ?

I tried Navigating to the defintion F12 leads to

#if !UNITY_MIN_5_3  && ! UNITY_2017 
// in Unity 5.3 and up, we have to use a SceneManager. This section re- 
implements it for older Unity versions

#if UNITY_EDITOR
namespace UnityEditor.SceneManagement
{
/// <summary>Minimal implementation of the EditorSceneManager for older 
Unity, up to v5.2.</summary>
public class EditorSceneManager
{
    public static int loadedSceneCount
    {
        get { return 
  string.IsNullOrEmpty(UnityEditor.EditorApplication.currentScene) ? -1 : 1; }
    }

    public static void OpenScene(string name)
    {
        UnityEditor.EditorApplication.OpenScene(name);
    }

    public static void SaveOpenScenes()
    {
        UnityEditor.EditorApplication.SaveScene();
    }

    public static void SaveCurrentModifiedScenesIfUserWantsTo()
    {
        UnityEditor.EditorApplication.SaveCurrentSceneIfUserWantsTo();
    }
}
}
#endif

 namespace UnityEngine.SceneManagement
{
 /// <summary>Minimal implementation of the SceneManager for older Unity, up 
to v5.2.</summary>
 public class SceneManager
  {
    public static void LoadScene(string name)
    {
        Application.LoadLevel(name);
    }

    public static void LoadScene(int buildIndex)
    {
        Application.LoadLevel(buildIndex);
    }
  }
 }

 #endif
1

1 Answers

4
votes

Try specifying which one to use to bypass the duplicated EditorSceneManager error like this:

using foo = UnityEditor.EditorSceneManager;
using boo = otherdll.Namespace;

BTW I think this error is because you have a DLL in .NET 4.x and a previous DLL from .NET 3.5, so you can probably just delete the one that is for 3.5.