How to Display Text from InputField and Save User name in Unity

Поділитися
Вставка
  • Опубліковано 6 кві 2021
  • In This video you will learn How to Display Text from InputField and Save User name in Unity 3d.
    This tutorial will teach you step by step how to Display Text from InputField and Save User name from script c#.
    🔔 Subscribe for More Tutorials: If you like what I'm doing, don't forget to like, share, and subscribe! let me know what do you think about this video in comments.
    🤝 Connect with Me:
    Website: grafikgames.com
    Instagram: / grafikgames
    Patreon: / grafikgames
    Other videos that will teach you Untiy:
    ➡️ How to create Toggle button in Unity 3d
    • Unity Toggle : How To ...
    ➡️ How to Update UI color from script in Unity 3D
    • Unity Change Color : H...
    ➡️ How to make Score in Unity 3D
    • Unity Score System : H...

КОМЕНТАРІ • 55

  • @kenancetin29
    @kenancetin29 Рік тому +1

    Thank you very much. It worked perfectly

  • @Daniel14Mejia
    @Daniel14Mejia 2 роки тому +2

    How do i do for the input to receive also paragraphs?

  • @syedaalena7902
    @syedaalena7902 2 роки тому +2

    How can we save list of names in playerprefs?

  • @MilometerSpear
    @MilometerSpear 3 роки тому +1

    Thank you!!!!!!!!!!

  • @imacutecatt
    @imacutecatt Рік тому +1

    thanks

  •  2 роки тому

    *Thanks!*

  • @gkn1589
    @gkn1589 3 роки тому +1

    thank you

    • @Grafikgames
      @Grafikgames  3 роки тому

      With pleasure thanks for your feedback

  • @parabesi7188
    @parabesi7188 Рік тому +1

    'PlayerPrefs' does not contain a definition for 'Getstring'

  • @vertix2347
    @vertix2347 2 роки тому +2

    Is there a method where you can enter your name, and the name showing on the screen in a other sceene

    • @Grafikgames
      @Grafikgames  2 роки тому +2

      //Add a text in the other scene and assign a tag to it
      // Create a new script.
      //Add new Empty Gameobject to the new scene and assign this script to it
      // play and text will be displayed when you open scene.
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using UnityEngine.UI;
      public class Update_text : MonoBehaviour
      {
      private Text obj_text;
      // Start is called before the first frame update
      void Start()
      {
      obj_text = GameObject.FindGameObjectWithTag("text").GetComponent();
      obj_text.text = PlayerPrefs.GetString("user_name");
      }
      }

    • @ethananderson2200
      @ethananderson2200 2 роки тому

      @@Grafikgames 2 months late but you coulkd have a public refrence to the name in a scripts

  • @gDevGuy001
    @gDevGuy001 2 роки тому +1

    what is the "PlayerPrefs"?? Is it a built-in function??

    • @Grafikgames
      @Grafikgames  2 роки тому

      The Player Prefs class in Unity is used to save small amounts of data from your game to disk, which allows you to store and recall single string, integer and float values between gameplay sessions. This can be extremely useful for saving and loading basic sets of data, such as option settings or simplified game saves.

  • @ESC-EDITS
    @ESC-EDITS 2 роки тому +2

    so how do I transfer the value I got from the first scene to the second scene

    • @Grafikgames
      @Grafikgames  2 роки тому

      Use PlayerPrefs, SetString, and GetString call it in the start methode.

    • @ESC-EDITS
      @ESC-EDITS 2 роки тому +1

      @@Grafikgames I assigned the text in the 2nd training as an asset, then I joined the first training, it worked, is it a problem?

    • @ESC-EDITS
      @ESC-EDITS 2 роки тому

      any scr i dont made it

    • @ESC-EDITS
      @ESC-EDITS 2 роки тому

      @@Grafikgames do you have a dc server fls l need your help :(

  • @WeLu11
    @WeLu11 Рік тому +1

    Hi, do you know how i can add another text but the old text should be saved?

    • @Grafikgames
      @Grafikgames  Рік тому

      PlayerPrefs only save one value, if u add another text , you will remove the previous one and it will be updated with the new text

    • @WeLu11
      @WeLu11 Рік тому +1

      @@Grafikgames and how can i make it that that the old text wouldnt be remmoved?

    • @Grafikgames
      @Grafikgames  Рік тому

      You can create an Input field next to text inputfield.
      You can put text that you want , and in the new input field create string '' YourNewText ''
      So when you click ok , the new text will be save in the new inputfield variable and you can call it everytime u want , maybe u can create a load methode which will load any text you want

    • @WeLu11
      @WeLu11 Рік тому

      @@Grafikgames and how can i make it endless, because i am making a game on one device and how can i make it endless so that as many players as the user wants can join

  • @llYuki0okami
    @llYuki0okami Рік тому +1

    worked when beggining of the code looks like this:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    using System.IO;
    using System.Linq;
    using TMPro;
    using UnityEngine.Events;
    using UnityEngine.EventSystems;
    public class DisplayText : MonoBehaviour
    {
    [SerializeField] TextMeshProUGUI obj_text;
    [SerializeField] TextMeshProUGUI display;
    and its not enought, you cant grap InputFile object, you need to grab object named Text that is inside InputFile object tree.

  • @ESC-EDITS
    @ESC-EDITS 2 роки тому +1

    Hi, I've done it all, but I can't drag and drop it to the objtest and displaytext in displaytext, I wonder why

    • @Grafikgames
      @Grafikgames  2 роки тому +1

      Did you make public text your script ?

    • @ESC-EDITS
      @ESC-EDITS 2 роки тому +1

      @@Grafikgames yeah dude

    • @Grafikgames
      @Grafikgames  2 роки тому

      Did you fix it ?

    • @ESC-EDITS
      @ESC-EDITS 2 роки тому +1

      @@Grafikgames no l did'nt

    • @Grafikgames
      @Grafikgames  2 роки тому

      Explain exactly.. how couldn't you drag the text?

  • @GamerAxlotl1
    @GamerAxlotl1 3 місяці тому

    Make a package

  • @deleonryanmiguelv.1630
    @deleonryanmiguelv.1630 Рік тому +1

    does dis work on mobile webgl

    • @Grafikgames
      @Grafikgames  Рік тому

      Yes , in Unity then build the game for mobile.

    • @deleonryanmiguelv.1630
      @deleonryanmiguelv.1630 Рік тому

      @@Grafikgames just for clarification, its webgl for website typing via mobile, not android apk right? so i can type a text in mobile web

  • @shershaahofficial2954
    @shershaahofficial2954 2 роки тому

    Many errors

    • @Grafikgames
      @Grafikgames  2 роки тому

      Did you use same steps ? Same script ?
      feel free to provide us your script.

    • @shershaahofficial2954
      @shershaahofficial2954 2 роки тому +1

      @@Grafikgames plz give me script

    • @Grafikgames
      @Grafikgames  2 роки тому

      @@shershaahofficial2954 i will paste the script soon in the video description..

    • @shershaahofficial2954
      @shershaahofficial2954 2 роки тому +1

      @@Grafikgames ok video link