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 /
  • Help Room /
avatar image
0
Question by jodyruben · Mar 20, 2017 at 03:02 AM · webglpasswordusername

Make username work on WebGL

hi, i got a project that requires a game , made by WebGL , with username and password but work offline. so i following up some tutorials that can make username and password work offline. but i got some problem that didnt work on WebGL. only work with exe. here's my code.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 using System;
 using System.Text.RegularExpressions;
 using UnityEngine.SceneManagement;
 
 public class Register : MonoBehaviour {
 
     public GameObject username;
     public GameObject kantorWilayah;
     public GameObject statusCabang;
     public GameObject cabangKoord;
     public GameObject kodeCabang;
     public GameObject inisialCabang;
     public GameObject alamat;
     public GameObject password;
     public GameObject confirmPassword;
     private string Username;
     private string KantorWilayah;
     private string StatusCabang;
     private string CabangKoord;
     private string KodeCabang;
     private string InisialCabang;
     private string Alamat;
     private string Password;
     private string ConfirmPassword;
     private string form;
 
     public void Back()
     {
         SceneManager.LoadScene ("AdminPanel");
     }
 
     public void EditID()
     {
         SceneManager.LoadScene ("EditID");
     }
 
     public void RegisterButton()
     {
         bool UN = false;
         bool KW = false;
         bool SC = false;
         bool CK = false;
         bool KC = false;
         bool IC = false;
         bool ALM = false;
         bool PW = false;
         bool CPW = false;
         //jika terisi username
         if (Username != "") {
             if (!System.IO.File.Exists (@"D:/UnityAdministrationFolder/" + Username + ".txt")) {
                 UN = true;
             } else {
                 print ("Kepake");
             }
         } else {
             print ("Kosong");
         }
         //password
         if(Password != "")
         {
             if(Password.Length > 5)
             {
                 PW = true;
             }
             else{
                 Debug.LogWarning("Password kudu lebih dr 6 karakter");
             }
         }
         else{
             Debug.LogWarning("Password kosong");
         }
         if(ConfirmPassword != "")
         {
             if(ConfirmPassword == Password)
             {
                 CPW = true;
             }else{
                 Debug.LogWarning("Konfirmasi Password ga sama");
             }
         }else{
             Debug.LogWarning("Konfirmasi Password kosong");
         }
         //KantorWilayah
         if (KantorWilayah != "") {
             KW = true;
         }
         if (StatusCabang != "") {
             SC = true;
         }
         if (CabangKoord != "") {
             CK = true;
         }
         if (KodeCabang != "") {
             KC = true;
         }
         if (InisialCabang != "") {
             IC = true;
         }
         if (Alamat != "") {
             ALM = true;
         }
 
         if(UN == true&&PW == true&&CPW == true&&KW == true&&SC == true&&CK == true&&KC == true&&IC == true&&ALM == true)
         {
             bool Clear = true;
             int i = 1;
             foreach(char c in Password)
             {
                 if(Clear)
                 {
                     Password = "";
                     Clear = false;
                 }
                 i++;
                 char Encrypted = (char)(c * i);
                 Password += Encrypted.ToString();
             }
 
             form = (Username + Environment.NewLine + KantorWilayah + Environment.NewLine + StatusCabang + Environment.NewLine + KodeCabang + Environment.NewLine + InisialCabang + Environment.NewLine + Alamat + Environment.NewLine + Environment.NewLine + Password);
             System.IO.File.WriteAllText(@"D:/UnityAdministrationFolder/" + Username + ".txt", form);
             username.GetComponent<InputField> ().text = "";
             kantorWilayah.GetComponent<InputField> ().text = "";
             statusCabang.GetComponent<InputField> ().text = "";
             cabangKoord.GetComponent<InputField> ().text = "";
             kodeCabang.GetComponent<InputField> ().text = "";
             inisialCabang.GetComponent<InputField> ().text = "";
             alamat.GetComponent<InputField> ().text = "";
             password.GetComponent<InputField> ().text = "";
             confirmPassword.GetComponent<InputField> ().text = "";
             SceneManager.LoadScene ("Title");
         }
     }
     
     // Update is called once per frame
     void Update () {
         if (Input.GetKeyDown (KeyCode.Tab)) {
             if (kantorWilayah.GetComponent<InputField> ().isFocused) {
                 statusCabang.GetComponent<InputField> ().Select ();
             }
             if (statusCabang.GetComponent<InputField> ().isFocused) {
                 cabangKoord.GetComponent<InputField> ().Select ();
             }
             if (cabangKoord.GetComponent<InputField> ().isFocused) {
                 kodeCabang.GetComponent<InputField> ().Select ();
             }
             if (kodeCabang.GetComponent<InputField> ().isFocused) {
                 inisialCabang.GetComponent<InputField> ().Select ();
             }
             if (inisialCabang.GetComponent<InputField> ().isFocused) {
                 alamat.GetComponent<InputField> ().Select ();
             }
             if (alamat.GetComponent<InputField> ().isFocused) {
                 username.GetComponent<InputField> ().Select ();
             }
             if (username.GetComponent<InputField> ().isFocused) {
                 password.GetComponent<InputField> ().Select ();
             }
             if (password.GetComponent<InputField> ().isFocused) {
                 confirmPassword.GetComponent<InputField> ().Select ();
             }
         }
 
         if (Input.GetKeyDown (KeyCode.Return)) {
             if (Username != ""&&StatusCabang != ""&&Password != ""&&ConfirmPassword != ""&&KantorWilayah != ""&&CabangKoord != ""&&KodeCabang != ""&&InisialCabang != ""&&Alamat != "") {
                 RegisterButton ();
             }
         }
         Username = username.GetComponent<InputField> ().text;
         Password = password.GetComponent<InputField> ().text;
         ConfirmPassword = confirmPassword.GetComponent<InputField> ().text;
         KantorWilayah = kantorWilayah.GetComponent<InputField> ().text;
         StatusCabang = statusCabang.GetComponent<InputField> ().text;
         CabangKoord = cabangKoord.GetComponent<InputField> ().text;
         KodeCabang = kodeCabang.GetComponent<InputField> ().text;
         InisialCabang = inisialCabang.GetComponent<InputField> ().text;
         Alamat = alamat.GetComponent<InputField> ().text;
     }
 }
 

hope someone can help. i looking for a solution out there , but i didnt understand how to use ExternalCall or ExternalEval. someone can help me? thanks for any help

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

0 Replies

· Add your reply
  • Sort: 

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

99 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

Related Questions

LogIn Using SQL stored procedure 0 Answers

C# to WebGL 2 Answers

WebGL issue - Release Build triggers error, Development Build runs fine 0 Answers

How to Make Proper Font used in WebGL build? 2 Answers

Pass mouseevents from Iframe to unity application (WebGL) 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