Welcome!

Welcome to our community forums, full of great people, ideas and excitement. Please register if you would like to take part.

This is extra text with a test link..

Register Now

Announcement

Collapse
No announcement yet.

Trigger script and Score help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trigger script and Score help

    Hello. I made a trigger at the bottom that should you fall on it, it puts the takeover screen up. However, it doesn't work. also, the Score seems off. I have the target script down correctly, and it should be working smoothly. I know not why it is not.

  • #2
    Here is the full script
    ["using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.SceneManagement;

    public class TriggerScript : MonoBehaviour
    {
    private void OnTriggerEnter(Collider other)
    {
    if (other.gameObject.tag == "Player")
    {
    SceneManager.LoadScene("Rocket_Runner_Game_Over", LoadSceneMode.Single);
    }
    }
    }"]

    Comment


    • #3
      Please copy/paste your script in uwing the code tags (#).

      The script looks pretty good. When you say it's not working, what do you mean? What error does the console show?

      You're sure:
      a) the FPSController is tagged as "Player"
      b) this script is attached to a Trigger (not just a box collider)
      c) the level Rocket_Runner_Game_Over is the exact name of the level and that that level is included in the Build Settings

      Comment


      • #4
        how do I attach it to a trigger?

        Comment


        • #5
          The same way we've been doing it on all the projects. Create a GameObject, create a Box Collider component and mark it as trigger. Then take your script and apply it to that GameObject.

          Comment

          Working...
          X