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 /
avatar image
0
Question by Nanochrom · Dec 09, 2011 at 09:06 PM · c#guitutorial

Making a Tutorial in th emiddle of screen and more efficiant

Hello,

im making a Tutorial for a game. My question now is how can i make the box apear in the middle of the screen. The other thing is i have a lot of bools right now but im afraid that if the tutorial should hold more information i will confuse myselfe with them.

I hope you can help me.

 using UnityEngine;

using System.Collections;

public class Tutorial : MonoBehaviour {

 private bool showTutorial = false;
 private bool endTutorial = false;
 private bool bewegungSteuerung = false;
 private bool turretErklaerung = false;
 private bool schildErklaerung = false;
 public Texture BG;
 public float vSbarValue;


 bool showGUI = false;

 void OnTriggerEnter()
 {
     if (!endTutorial)
     {
         showTutorial = true;
         showGUI = true;


     }
 }

 void Update()
 {
     if (!endTutorial && showTutorial)
     {
         Time.timeScale = 0; //Frezze time

     }
     if (endTutorial)
     {
         Time.timeScale = 1; //Frezze time
         showGUI = false;
     }
 }

 void OnGUI()
 {
     if (showGUI)
     {
         GUILayout.BeginArea(new Rect((Screen.width - 1000), (Screen.height - 500), (Screen.width / 100) * 75, (Screen.height / 100) * 60), BG); //Die box für den text
         GUILayout.EndArea();
         GUILayout.BeginArea(new Rect((Screen.width - 925), (Screen.height - 400), (Screen.width / 100) * 25, (Screen.height / 100) * 45)); //Die box für den text

         


         if (showTutorial && !endTutorial)
         {
             GUILayout.Label("Wilkommen in unserem Mächting tutorial!");
             GUILayout.Label("Wilkommen im Tutorail LVL hier erfährst du die wichtigsten Spielelemente.");
             if (GUILayout.Button("Ja, erkläre mir das Wichtigste!"))
             {
                 bewegungSteuerung = true;
                 showTutorial = false;
                 endTutorial = false;
             }
             if (GUILayout.Button("ICH BIN EIN PRO! SCHLUSS DAMIT"))
             {
                 bewegungSteuerung = false;
                 schildErklaerung = false;
                 turretErklaerung = false;
                 endTutorial = true;
             }
         }
         if (bewegungSteuerung == true)
         {
             GUILayout.Label("Bewegungs steuerung (BroBot und FemBot)");
             GUILayout.Label("Du bewegst dich durch den LVL ");
             if (GUILayout.Button("GIB MIR MEHR INFOS ÜBER DIE GEGNER"))
             {
                 turretErklaerung = true;
                 bewegungSteuerung = false;
             }
             if (GUILayout.Button("AHHH LASS MICH RAUS ICH WILL ZOCKEN"))
             {
                 bewegungSteuerung = false;
                 turretErklaerung = false;
                 endTutorial = true;
             }
         }
         if (turretErklaerung == true)
         {
             GUILayout.Label("Einführung in die Gegner (BroBot und FemBot)");
             GUILayout.Label("In diesem Spiel gibt es Zwei verschiedene arten von Gegnern.");
             if (GUILayout.Button("JA ERZÄHL MIR MEHR ÜBER DAS SCHILD"))
             {
                 schildErklaerung = true;
                 turretErklaerung = false;
             }
             if (GUILayout.Button("ICH WILL JETZT ENDLICH ZOCKEN"))
             {
                 bewegungSteuerung = false;
                 schildErklaerung = false;
                 turretErklaerung = false;
                 endTutorial = true;
             }
         }
         if (schildErklaerung == true)
         {
             GUILayout.Label("Einführung in das Schild (BroBot only)");
             GUILayout.Label("Um den Schild zu aktivieren drücke.");
             if (GUILayout.Button("ICH HABE ALLES GELESEN, VORTSETZEN"))
             {
                 schildErklaerung = false;
                 turretErklaerung = false;
                 endTutorial = true;
             }
         }

         GUILayout.EndArea();
     }
 }

}

Comment
Add comment · Show 2
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 Berenger · Jan 31, 2013 at 04:25 PM 0
Share

What box ? A gui box ?

avatar image Dann858 · Jan 31, 2013 at 04:29 PM 0
Share

Well. As you can see from

 if (GUILayout.Button("ICH WILL JETZT ENDLICH ZOC$$anonymous$$EN"))

Then he is using GUI Boxes

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Dann858 · Jan 31, 2013 at 04:23 PM

I don't exactly see the problem in the bools. Their names are pretty understandable. (I can speak a little bit German)

I've used a script of some sort like this. It's bigger and I call them

 public bool DisplayText1;
 public bool DisplayContinueButton1;

 public bool DisplayText2;
 public bool DisplayContinueButton2;

etc.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

GUI functions switching 2 Answers

Multiple Cars not working 1 Answer

Drawing 4 GUIButton's with a forloop. Need help changing color? 1 Answer

GUI objects jitter when following "lerped" Gameobject [SOLVED] 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