Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Dec 11, 2014 at 01:50 PM by meat5000 for the following reason:

Self answered. User Error

avatar image
0
Question by SuperReaper1999 · Dec 11, 2014 at 12:01 PM · javascript

So i made a pause menu for my game and it works on the first level but doesnt work on any other levels, anyone have any idea as to why this is?

The script that i use for all the buttons in the menu

pragma strict

 var pauseKey : KeyCode;
 
 var PauseActive : GameObject;
 
 function Update () {
     if (Input.GetKeyUp(pauseKey) && PauseActive.GetComponent(Canvas).enabled == false){
         Pause();
     }else if (Input.GetKeyUp(pauseKey) && PauseActive.GetComponent(Canvas).enabled == true){
         UnPause();
     }
 }
 
 function Pause () {
     PauseActive.GetComponent(Canvas).enabled = true;
     Debug.Log("Paused");
     Time.timeScale = 0f;
 }
 
 function UnPause () {
     PauseActive.GetComponent(Canvas).enabled = false;
     Debug.Log("Un-paused");
     Time.timeScale = 1f;
 }
 
 function SaveGame () {
     PlayerPrefs.SetInt("LevelNumber", Application.loadedLevel);
     Debug.Log("Game has been saved!");
 }
 

on the first level if i press the pauseKey the ui shows up and all the buttons are selectable, if i do it on the second level or any other level it shows the ui but the buttons arent selectable i have it setup in the exact same way on ever scene. if anyone has any ideas how to fix this please let me know as its been frustrating me for 3 days now!

Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image KiraSensei · Dec 11, 2014 at 12:02 PM 0
Share

I don't see anything specific to the current level you are. Could you tell us at what game object this script is attached ? On every level.

avatar image SuperReaper1999 · Dec 11, 2014 at 12:45 PM 0
Share

It is attatched to an empty game object that has the canvas attached to it which is where the buttons are, i put that into a prefab and when i put the prefab into another level the buttons on the menu don't get highlighted when i hover over them or anything :/

avatar image meat5000 ♦ · Dec 11, 2014 at 12:56 PM 0
Share

Check the GameObject references in Editor's Inspector after loading the second scene. Perhaps they are lost.

avatar image SuperReaper1999 · Dec 11, 2014 at 01:13 PM 0
Share

they are still there i even deleted and re added them just to make sure :/

avatar image KiraSensei · Dec 11, 2014 at 01:36 PM 0
Share

Could you share your project, or at least make a very simple project with this problem reproducible, and give us a link to it ?

Show more comments

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by SuperReaper1999 · Dec 11, 2014 at 01:49 PM

I fixed the issue, turns out i am stupid and had forgotten about the EventSystem needing to be in the scene. very sorry to have wasted everyone's time.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

How i make this code in Unity Javascript 2 Answers

AI navigating all 6 sides of a cube 0 Answers

using Application.OpenURL for opening new tab? 2 Answers

Vehicle Won't go past 2nd gear. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges