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 Giannigiardinelli · Feb 26, 2018 at 01:19 AM · unity 5uiguiscript.convert

How Converting GUILayout.TextField with UI InputField ?

Hello, I wanted to know if it was possible to convert the "GUILayout. TextField" With that of "InputField" of UI?

I have a code that uses the GUILayout. TextField "or it makes calls to scripts" [System. Serializable] "and the line of the GUILayou do calls to" string "" int "... is it possible to convert the line with the variable" InputField "of the function UI?

Thanks in advance !

SCRIPT : Menu

 public class Menu : MonoBehaviour {
 
     public enum MenuEnum {
         MainMenu,
     }
 
     public MenuEnum currentMenu;
 
     void OnGUI () {
 
         GUILayout.BeginArea(new Rect(0,0,Screen.width, Screen.height));
         GUILayout.BeginHorizontal();
         GUILayout.FlexibleSpace();
         GUILayout.BeginVertical();
         GUILayout.FlexibleSpace();
 
 
 
 if (currentMenu == MenuEnum .MainMenu) {
 GUILayout.Label("Pseudo");
             Game.current.Pseudo.Name= GUILayout.TextField(Game.current.Pseudo.Name, 20);
 }
         GUILayout.FlexibleSpace();
         GUILayout.EndVertical();
         GUILayout.FlexibleSpace();
         GUILayout.EndHorizontal();
         GUILayout.EndArea();
 }
 

SCRIPT : Game

 using UnityEngine;
 using System.Collections;
 
 [System.Serializable]
 public class Game { 
 
     public static Game current;
 
     public NamePlayer Pseudo;
 
     public Game () {
 
         Pseudo = new NamePlayer ();
     }
         
 }


SCRIPT : NamePlayer

 using UnityEngine;
 using System.Collections;
 
 [System.Serializable]
 public class NamePlayer{
 
     public string Name;
 
     public NamePlayer() {
         this.Name= "";
     }
 
 }








Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by ElijahShadbolt · Feb 26, 2018 at 07:41 AM

I made an example scene, to give you a head start. Copy the folder in exampleuilayout.zip into the assets folder of a new Unity project, and open the Scene.


exampleuilayout.zip (10.2 kB)
Comment
Add comment · Show 3 · 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
avatar image Giannigiardinelli · Feb 26, 2018 at 08:22 AM 0
Share

Hello!

Thank you for your help! You have reconstituted the scripts that I send it's really nice of you to have taken the time to help me convert !!! I am in to take my head on the recording of the evolution of the player via the "menu"! I'll look at what you've done to me beautiful and see if the code is fit in what I want to try to do!

Thank you so much again I keep you in the juice, if I have to share an example in the form of drafts with all the scripts on the "serialization" of the recording of the "$$anonymous$$enu" via the evolution of the player!

avatar image ElijahShadbolt Giannigiardinelli · Feb 27, 2018 at 02:43 AM 0
Share

Haha, I'm glad I could help. $$anonymous$$ind marking my answer as Correct?

avatar image Giannigiardinelli ElijahShadbolt · Mar 02, 2018 at 07:08 AM 0
Share

So I try the example you give me but unfortunately it does not work... In fact I wanted to convert the script GUI into UI and power save a progress by user with diferent users

But currently I'm still looking and digging in my head to find out how I can do.... I would infact if two players want to play on the same game... How do I make sure that each player has his own backup through their nickname back up from the beginning of the game? Is there a way to save multiple users and when loading,display the saved users and choose what to load?

Example:

User names > "John"> is 500 points, 100% life, level 5

User names > "michael"> is 2500 point, 100% life, Level 18

Thanks in advance if there is anyone who can help me!

avatar image
0

Answer by Giannigiardinelli · Mar 02, 2018 at 02:44 PM

My head is going to explode... I can't find a solution...

So I try the example you give me but unfortunately it does not work... In fact I wanted to convert the script GUI into UI and power save a progress by user with diferent users

But currently I'm still looking and digging in my head to find out how I can do.... I would infact if two players want to play on the same game... How do I make sure that each player has his own backup through their nickname back up from the beginning of the game? Is there a way to save multiple users and when loading,display the saved users and choose what to load?

Example:

User names > "John"> is 500 points, 100% life, level 5

User names > "michael"> is 2500 point, 100% life, Level 18

Thanks in advance if there is anyone who can help me!

 public int numUsers;
 public string[] usersNumber;    
     
 
         public void CreateNewsUserNames()
     
     {
             usersNumber = new String[numUsers+=1]; 
     
     }


I use script to create several "Text" for creating multiple backups of each different player. Except that the variable is empty there is no "Prefab" and I do not know how I can write this. And in addition I can not find a solution for Creates different nicks and that each player with their name matches their record of their game... Thanks in advance

Comment
Add comment · Show 2 · 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
avatar image ElijahShadbolt · Mar 03, 2018 at 12:25 AM 0
Share

You should make a new question on Unity Answers for this. I cannot understand you because your English sentences are not that good.

avatar image Giannigiardinelli ElijahShadbolt · Mar 03, 2018 at 07:47 AM 0
Share

Unfortunately my English is not so well written. Like you said. I am French at the moment I have to help myself with a translator. Well I'll see if I create another post for my problem. Despite that I continue to look for the solution thank you

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

240 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 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 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

Camera Culling Masks - Assigned Layers Not Respected for GUI elements 0 Answers

Drawing UI text on GUI.DrawTexture , How to do it ? 1 Answer

Problem with build version 1 Answer

Unity5 WheelCollider UI not showing???? 4 Answers

How to draw dynamic new gui 0 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