Create Dialog Box/pop up windows












-1















have such code



bool b = EditorUtility.DisplayDialog("Test",
"Reset or continue?", "Reset", "Continue");
if (b)
{
ResetGame();
}


but it works only in Editor and not in Game. How to replace the EditorUtility.DisplayDialog with something that works for game?










share|improve this question





























    -1















    have such code



    bool b = EditorUtility.DisplayDialog("Test",
    "Reset or continue?", "Reset", "Continue");
    if (b)
    {
    ResetGame();
    }


    but it works only in Editor and not in Game. How to replace the EditorUtility.DisplayDialog with something that works for game?










    share|improve this question



























      -1












      -1








      -1








      have such code



      bool b = EditorUtility.DisplayDialog("Test",
      "Reset or continue?", "Reset", "Continue");
      if (b)
      {
      ResetGame();
      }


      but it works only in Editor and not in Game. How to replace the EditorUtility.DisplayDialog with something that works for game?










      share|improve this question
















      have such code



      bool b = EditorUtility.DisplayDialog("Test",
      "Reset or continue?", "Reset", "Continue");
      if (b)
      {
      ResetGame();
      }


      but it works only in Editor and not in Game. How to replace the EditorUtility.DisplayDialog with something that works for game?







      c# unity3d






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 6 '17 at 7:30









      Programmer

      77.7k1089158




      77.7k1089158










      asked Apr 22 '16 at 19:01









      user3153616user3153616

      246




      246
























          1 Answer
          1






          active

          oldest

          votes


















          3














          Any Unity class that includes the word "Editor" or came from the UnityEditor namespace means that the class is designed to used in the Editor only and will only work in the Editor. So EditorUtility is for Unity Editor only.



          You need to implement your own Modal Window and to be able to this, you must understand basic Unity UI such as creating buttons, panels, texts. So learn the Unity basic UI first. All you need to do is to put the UI Objects in a panel then acivate/deactivate them when needed.



          For example, this is your dialogue panle:



          public GameObject dialoguePanel;


          to show a dialogue of the UI Panel



          dialoguePanel.SetActive(true);


          To hide it:



          dialoguePanel.SetActive(false);


          You can subscribe to the dialogue's button or UI controls events dynamically with onClick.AddListener. See this post for more information on how to subscribe to UI events.



          If you still can't implement your Modal Window, then follow the tutorials below as that's exactly what you are looking for.



          Unity Tutorial for a generic modal Window:



          MAKING A GENERIC MODAL WINDOW Part 1



          MAKING A GENERIC MODAL WINDOW Part 2



          MAKING A GENERIC MODAL WINDOW Part 3






          share|improve this answer


























          • how to make your own window ?

            – user3153616
            Apr 22 '16 at 19:15











          • @user3153616 You can call it a dialog but it can be called a modal window... It becomes a Modal window when you have a dialog with background picture and can be moved around if you want it to. The tutorials 1 to 3 will show you how.

            – Programmer
            Apr 22 '16 at 19:23













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f36801470%2fcreate-dialog-box-pop-up-windows%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          Any Unity class that includes the word "Editor" or came from the UnityEditor namespace means that the class is designed to used in the Editor only and will only work in the Editor. So EditorUtility is for Unity Editor only.



          You need to implement your own Modal Window and to be able to this, you must understand basic Unity UI such as creating buttons, panels, texts. So learn the Unity basic UI first. All you need to do is to put the UI Objects in a panel then acivate/deactivate them when needed.



          For example, this is your dialogue panle:



          public GameObject dialoguePanel;


          to show a dialogue of the UI Panel



          dialoguePanel.SetActive(true);


          To hide it:



          dialoguePanel.SetActive(false);


          You can subscribe to the dialogue's button or UI controls events dynamically with onClick.AddListener. See this post for more information on how to subscribe to UI events.



          If you still can't implement your Modal Window, then follow the tutorials below as that's exactly what you are looking for.



          Unity Tutorial for a generic modal Window:



          MAKING A GENERIC MODAL WINDOW Part 1



          MAKING A GENERIC MODAL WINDOW Part 2



          MAKING A GENERIC MODAL WINDOW Part 3






          share|improve this answer


























          • how to make your own window ?

            – user3153616
            Apr 22 '16 at 19:15











          • @user3153616 You can call it a dialog but it can be called a modal window... It becomes a Modal window when you have a dialog with background picture and can be moved around if you want it to. The tutorials 1 to 3 will show you how.

            – Programmer
            Apr 22 '16 at 19:23


















          3














          Any Unity class that includes the word "Editor" or came from the UnityEditor namespace means that the class is designed to used in the Editor only and will only work in the Editor. So EditorUtility is for Unity Editor only.



          You need to implement your own Modal Window and to be able to this, you must understand basic Unity UI such as creating buttons, panels, texts. So learn the Unity basic UI first. All you need to do is to put the UI Objects in a panel then acivate/deactivate them when needed.



          For example, this is your dialogue panle:



          public GameObject dialoguePanel;


          to show a dialogue of the UI Panel



          dialoguePanel.SetActive(true);


          To hide it:



          dialoguePanel.SetActive(false);


          You can subscribe to the dialogue's button or UI controls events dynamically with onClick.AddListener. See this post for more information on how to subscribe to UI events.



          If you still can't implement your Modal Window, then follow the tutorials below as that's exactly what you are looking for.



          Unity Tutorial for a generic modal Window:



          MAKING A GENERIC MODAL WINDOW Part 1



          MAKING A GENERIC MODAL WINDOW Part 2



          MAKING A GENERIC MODAL WINDOW Part 3






          share|improve this answer


























          • how to make your own window ?

            – user3153616
            Apr 22 '16 at 19:15











          • @user3153616 You can call it a dialog but it can be called a modal window... It becomes a Modal window when you have a dialog with background picture and can be moved around if you want it to. The tutorials 1 to 3 will show you how.

            – Programmer
            Apr 22 '16 at 19:23
















          3












          3








          3







          Any Unity class that includes the word "Editor" or came from the UnityEditor namespace means that the class is designed to used in the Editor only and will only work in the Editor. So EditorUtility is for Unity Editor only.



          You need to implement your own Modal Window and to be able to this, you must understand basic Unity UI such as creating buttons, panels, texts. So learn the Unity basic UI first. All you need to do is to put the UI Objects in a panel then acivate/deactivate them when needed.



          For example, this is your dialogue panle:



          public GameObject dialoguePanel;


          to show a dialogue of the UI Panel



          dialoguePanel.SetActive(true);


          To hide it:



          dialoguePanel.SetActive(false);


          You can subscribe to the dialogue's button or UI controls events dynamically with onClick.AddListener. See this post for more information on how to subscribe to UI events.



          If you still can't implement your Modal Window, then follow the tutorials below as that's exactly what you are looking for.



          Unity Tutorial for a generic modal Window:



          MAKING A GENERIC MODAL WINDOW Part 1



          MAKING A GENERIC MODAL WINDOW Part 2



          MAKING A GENERIC MODAL WINDOW Part 3






          share|improve this answer















          Any Unity class that includes the word "Editor" or came from the UnityEditor namespace means that the class is designed to used in the Editor only and will only work in the Editor. So EditorUtility is for Unity Editor only.



          You need to implement your own Modal Window and to be able to this, you must understand basic Unity UI such as creating buttons, panels, texts. So learn the Unity basic UI first. All you need to do is to put the UI Objects in a panel then acivate/deactivate them when needed.



          For example, this is your dialogue panle:



          public GameObject dialoguePanel;


          to show a dialogue of the UI Panel



          dialoguePanel.SetActive(true);


          To hide it:



          dialoguePanel.SetActive(false);


          You can subscribe to the dialogue's button or UI controls events dynamically with onClick.AddListener. See this post for more information on how to subscribe to UI events.



          If you still can't implement your Modal Window, then follow the tutorials below as that's exactly what you are looking for.



          Unity Tutorial for a generic modal Window:



          MAKING A GENERIC MODAL WINDOW Part 1



          MAKING A GENERIC MODAL WINDOW Part 2



          MAKING A GENERIC MODAL WINDOW Part 3







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 6 '17 at 7:38

























          answered Apr 22 '16 at 19:12









          ProgrammerProgrammer

          77.7k1089158




          77.7k1089158













          • how to make your own window ?

            – user3153616
            Apr 22 '16 at 19:15











          • @user3153616 You can call it a dialog but it can be called a modal window... It becomes a Modal window when you have a dialog with background picture and can be moved around if you want it to. The tutorials 1 to 3 will show you how.

            – Programmer
            Apr 22 '16 at 19:23





















          • how to make your own window ?

            – user3153616
            Apr 22 '16 at 19:15











          • @user3153616 You can call it a dialog but it can be called a modal window... It becomes a Modal window when you have a dialog with background picture and can be moved around if you want it to. The tutorials 1 to 3 will show you how.

            – Programmer
            Apr 22 '16 at 19:23



















          how to make your own window ?

          – user3153616
          Apr 22 '16 at 19:15





          how to make your own window ?

          – user3153616
          Apr 22 '16 at 19:15













          @user3153616 You can call it a dialog but it can be called a modal window... It becomes a Modal window when you have a dialog with background picture and can be moved around if you want it to. The tutorials 1 to 3 will show you how.

          – Programmer
          Apr 22 '16 at 19:23







          @user3153616 You can call it a dialog but it can be called a modal window... It becomes a Modal window when you have a dialog with background picture and can be moved around if you want it to. The tutorials 1 to 3 will show you how.

          – Programmer
          Apr 22 '16 at 19:23






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f36801470%2fcreate-dialog-box-pop-up-windows%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Contact image not getting when fetch all contact list from iPhone by CNContact

          count number of partitions of a set with n elements into k subsets

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks