Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

script error

Discussion in 'Scripting' started by ahmedalheday, May 8, 2014.

  1. ahmedalheday

    ahmedalheday

    Joined:
    Feb 24, 2014
    Posts:
    103
    `UnityEngine.Application' does not contain a definition for `LoedLevel'
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,936
  3. Kondor0

    Kondor0

    Joined:
    Feb 20, 2010
    Posts:
    596
    You made a typo appparently, did you mean LoadLevel?
     
  4. ahmedalheday

    ahmedalheday

    Joined:
    Feb 24, 2014
    Posts:
    103
    error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer

    now it changed to this
     
  5. Patico

    Patico

    Joined:
    May 21, 2013
    Posts:
    886
    There is another one typo ))) Post the line of code where error occurs.
     
  6. ahmedalheday

    ahmedalheday

    Joined:
    Feb 24, 2014
    Posts:
    103
    where does the error occur ?
     
  7. ahmedalheday

    ahmedalheday

    Joined:
    Feb 24, 2014
    Posts:
    103
    nothing is wrong ?



    using UnityEngine;
    using System.Collections;

    public class BallScript : MonoBehaviour
    {

    public float speed;
    public GUIText countText;
    public GUIText wintext;
    private int count;

    void Start ()
    {
    count = 0;
    SetCountText ();
    wintext.text = "";
    }

    void FixedUpdate ()
    {
    float moveHorizontal = Input.GetAxis ("Horizontal");
    float moveVertical = Input.GetAxis ("Vertical");

    Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);

    rigidbody.AddForce (movement * speed * Time.deltaTime);
    }

    void OnTriggerEnter(Collider other)
    {
    if(other.gameObject.tag == "PickUp")
    {
    other.gameObject.SetActive(false);
    count = count + 1;
    SetCountText ();
    }
    }

    void SetCountText ()
    {
    countText.text = "Count: " + count.ToString();
    if(count >= 12)
    {
    wintext.text = "YOU WIN";
    {

    }
    Application.LoadLevel = ("Level-2");
    }
    }
    }
     
  8. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    Please use code tags when posting code: http://forum.unity3d.com/threads/143875-Using-code-tags-properly

    The error message gives you the line of the error.

    This is where your error is. You can't assign a value to it, because it is not a variable. It's a function, you have to call it like you did SetCountText ()

    Code (csharp):
    1.  
    2. Application.LoadLevel ("Level-2");
    3.  
     
  9. ahmedalheday

    ahmedalheday

    Joined:
    Feb 24, 2014
    Posts:
    103
    IT SHOWS ME THIS

    Level 'Level-2' (-1) couldn't be loaded because it has not been added to the build settings.
    To add a level to the build settings use the menu File->Build Settings...
    UnityEngine.Application:LoadLevel(String)
    BallScript:SetCountText() (at Assets/BallScript.cs:48)
    BallScript:OnTriggerEnter(Collider) (at Assets/BallScript.cs:35)

    I DID ADD IT TO THE BUILD SITTINGS
     
  10. hadicoco

    hadicoco

    Joined:
    May 10, 2014
    Posts:
    13
    It's reporting an index of -1, which means the level wasn't found in the build settings