Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
avatar image
0
Question by $$anonymous$$ · Dec 12, 2017 at 04:11 AM · buttonexitfunction call

Exit button stopped working

I originally had an exit button set up just for show, and when clicked it would call a function that would write "Game exited" to the console. However, after adding the code that will actually make the game go through my end game sequence, the button no longer works. It's like I can't click it anymore. I tried to have it write to the console again, but nothing happened. I have the information in the inspector set up so that the On Click() option is: Runtime only, on the ExitButton script, and the function used it ExitButton.ExitTheGame. This is my code for the ExitButton script:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class ExitButton : MonoBehaviour {
 
     public GameOverManager gom;
 
     public void ExitTheGame(){
         Debug.Log ("Exit Button pushed");
 
         gom.SetBoolGO ();
 
     } 
 
 }

This calls a function in the GameOverManager that will set a boolean value to true, which tells that script to activate the GameOver Screen and exit. I don't know what I did wrong, but it wont work any more. If anyone thinks that they can help me, I could really use some guidance.

-Thanks!

Comment
Add comment · Show 4
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 JedBeryll · Dec 12, 2017 at 05:34 AM 0
Share

Do you still have an event system in the scene? Is the button graphic marked as raycast target?

avatar image $$anonymous$$ JedBeryll · Dec 12, 2017 at 06:43 AM 0
Share

Yes, it is. And, I actually just figured out what was wrong. I had added a flash image that stretches across the screen that will flash red whenever the player is hurt (very similar to the survival shooter tutorial, if you know of it), and my exit button was under this image. I did not realize this because the alpha for the image had been turned to zero until the player is hurt. Once I moved the button to on top of this image, the button worked again.

avatar image JedBeryll JedBeryll · Dec 12, 2017 at 07:23 AM 0
Share

Just a note: you could also turn off raycast target on the red flash. You should add your solution as an answer so others see it as answered.

avatar image $$anonymous$$ JedBeryll · Dec 12, 2017 at 08:30 AM 1
Share

Thank you for your help, and I will!

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by $$anonymous$$ · Dec 12, 2017 at 08:32 AM

For anyone who is having this issue I found the solution:

I had added a flash image that stretches across the screen that will flash red whenever the player is hurt (very similar to the survival shooter tutorial, if you know of it), and my exit button was under this image. I did not realize this because the alpha for the image had been turned to zero until the player is hurt. Once I moved the button to on top of this image, the button worked again.

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

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

84 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Button doesn't work after build 1 Answer

Make a button quit the game, Unity 4.6 UI C# 1 Answer

Menu button in game isn't working 0 Answers

Unity 5.0.2f1 UI Button OnClick Function 6 Answers

Make a UI button quit the exe, Unity 5 2 Answers


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