Search Unity

LoadLevel issue.

Discussion in 'Scripting' started by ArrayCS, Sep 20, 2017.

  1. ArrayCS

    ArrayCS

    Joined:
    Sep 18, 2017
    Posts:
    29
    So i've found a script that changes to another level when triggered. There is a problem though. when i input the script it works but i get this yellow error at the bottom of my screen.

    Assets/Scripts/LoadLevel.js(8,21): BCW0012: WARNING: 'UnityEngine.Application.LoadLevel(String)' is obsolete. Use SceneManager.LoadScene.

    when i swap out the loadlevel with scenemanger.loadscene it gives me a red error saying this

    Assets/Scripts/LoadLevel.js(8,21): BCW0012: WARNING: 'UnityEngine.Application.LoadLevel(String)' is obsolete. Use SceneManager.LoadScene

    i dont like getting errors. this is the script when im getting the yellow errors. the script thats giving me the red error is the exact same but instead of Application.LoadLevel its SceneManager.LoadScene

    PS. The Code is in .js format. i dont know why it says csharp.
    Code (csharp):
    1.  
    2. #pragma strict
    3.  
    4. function Start () {
    5.  
    6. }
    7.  
    8. function OnTriggerEnter () {
    9.     Application.LoadLevel("2");
    10. }
    11.  
    Please help. i can still play with the yellow errors but they're bugging me :/
     
  2. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
  3. ArrayCS

    ArrayCS

    Joined:
    Sep 18, 2017
    Posts:
    29