• 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
Question by damaskox_unity · Sep 09, 2017 at 07:55 PM · buttonscript.deactivatewithoutmessagebox

Can I deactivate a messagebox without any scripting?

Greetings to you all!

I did some research about my problem in advance through Google, but I found only solutions WITH scripting.


Today I started to build up my first "something" I could call a game at some day, if I'm up to see it to the end.

From a button and a message box tutorial videos in YouTube I learned to make basic buttons and two basic(?) message boxes.

Through poking around between the button object and a panel with text in it I was able to open a message box through clicking a button. I did this without scripting, since I kinda like the way to get stuff working without scripting (as long as I can help to avoid it).

So, through the GameObject.SetActive -command (chosen from the dropdown list) I managed to open the message box. I added an X-button on the messagebox and hoped to find a function similar to mentioned before to do the reverse action - again, without coding.

To my slight astonishment however, I didn't see any of the sort. I couldn't find any alternative function available in the dropdown list to my little X-button in my message box to close my message box. (Or I couldn't know/understand that any of the given commands could do the trick)

Is there any way to get a function to close a message box (through a button inside the message box) without coding? If not, I need to figure out, how to code the function and how to add it in the right place =(

Thanks in advance!

(I also wish to be able to reopen that message box when you click the same button, so I am not looking for options to completely/fully disable the message box)

Comment

People who like this

0 Show 1
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 imXela · Sep 09, 2017 at 08:02 PM 0
Share

Isn't there a little checkbox next to the buttons SetActive event? I believe there should be, if it's set to unchecked it will disable the message, making it invisble. alt text

skarmklipp.png (25.4 kB)

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by TheSOULDev · Sep 10, 2017 at 12:28 PM

Unless you literally have a full "for dummies" engine in Unity (like RPG Maker), you won't be able to do anything significant without scripting. To make a messagebox close when a button is pressed in the same message box, add a button component to the game object you want to act as a button, then open up your message box script, add a function that looks something like this:

 public void CloseMessageBox(GameObject MessageBox)
 {
     MessageBox.SetActive(false);
     return;
 }

And add that method to the button component OnClick() Unity Event.

If you want the function to act as a toggle, use this:

 public void ToggleMessageBox(GameObject MessageBox)
     {
         MessageBox.SetActive(!MessageBox.activeSelf);
         return;
     }
Comment

People who like this

0 Show 0 · 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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

83 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

Related Questions

Script for a GUI button to change an object's rotation? 1 Answer

if button is highlighted run script (non-mouse) 0 Answers

Instantiate on click if enough gold / ressources 2 Answers

How to display exact video by index, property on button click 0 Answers

Trying to have a button when pressed randomly generates 5 numbers, but I am getting an error that says Text has no receiver 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