Home>

Unity uses javascript.
Although import is described at the top of the script, it may not be used well in subsequent calls.

Specifically, if you write a script like the one below,
BCE0019:'LoadScene'is not a member of'SceneManager&apos ;.

#pragma strict
import UnityEngine.SceneManagement;
function Start () {
    SceneManager.LoadScene (1);
}

However, UnityEngine.SceneManagement.SceneManager.LoadScene (1);
Will start normally.

I think that there is a problem and import failed. Can you tell me what is the cause?

  • Answer # 1

    I'm not used to JavaScript and I wasn't confident, but it seems that it was the same case as "Can't make a transition due to a CS0117 error in a Unity scene transition".

    Since the error message does not directly point to the name cover, it may be a case where it is likely to take time to find the cause. Searching for "BCE0019" seems to be dominated by other causes.
    Cases caused by name cover are "script name is easy to understand, but too easy to understand is dangerous?-Mostly low-flying" and "blog articles that summarize the differences between JavaScript in Unity and JavaScript in the browser-on high fire It was mentioned in "Progress".

    This time, I provided information thatUnityEngine.SceneManagement.SceneManager.LoadScene (1);worked, so I came up with the cause relatively easily. Thank you very much.

    ※ As I looked at earlier, as FiveHundred pointed out, it seems that JavaScript has already been deleted from "Assets" → "Create" → "Legacy" if it is the current version. It may be a good opportunity to move to C #.

  • Answer # 2

    As you pointed out, it was resolved by changing the duplicate class name.
    Thank you very much!