Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Can you help me fix these errors?

Discussion in 'Getting Started' started by M1k0M1k, May 6, 2021.

  1. M1k0M1k

    M1k0M1k

    Joined:
    Aug 21, 2020
    Posts:
    3
    I'm very new here and I've been following this tutorial
    . I am trying to make it so when the ball drops below y -25 the level resets. I've got these errors and I don't know what to do with them. I can't find any missing ";" and I can't find any way online to fix the other ones.
    upload_2021-5-6_14-54-49.png
    Here is my code:

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

    public class youDed : MonoBehaviour
    {
    public float threshold = -25f;

    void Update()
    {
    if(transform.position.y < threshold)
    {
    SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }
    }
    }
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    JoeStrout likes this.
  3. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Compare your code to 9:33 in the video, you should see the error. Hint, it's a missing .
     
  4. M1k0M1k

    M1k0M1k

    Joined:
    Aug 21, 2020
    Posts:
    3
  5. M1k0M1k

    M1k0M1k

    Joined:
    Aug 21, 2020
    Posts:
    3
    Yes, I already found it but still thanks!