Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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
1
Question by DNS · Feb 12, 2018 at 10:54 AM · webglwwwurllink

Dynamic link url and text in WebGL build

Hello, the idea is:

The game should display a list of links (text + button on which the link script hangs). It should be possible to change these links with the text after the publication.

That is, store the text + link in json or xml on the server and that would build them up when loading ...

The question is, which method is the best / easier to implement? I will be grateful for the tip in the direction of what to watch.alt text

futured-youtubers.png (90.3 kB)
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
0

Answer by upasnavig90 · Feb 12, 2018 at 11:16 AM

Make a prefab , instantiate at run time for all the links you have and use onClick.AddListener with the parameter of link u want to open.

you can check it on https://docs.unity3d.com/ScriptReference/UI.Button-onClick.html

this might be helpful for you:

 foreach (var item in links) {
                 GameObject newlink = GameObject.Instantiate (linkPrefab)as GameObject;
                 newlink.GetComponent<Button> ().onClick.AddListener (()=>OnClickDenomination (yourLink));
 
             }
Comment
Add comment · Show 1 · 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 DNS · Feb 12, 2018 at 02:20 PM 0
Share

The difficulty is that at the time of the build I have no references. I need to build build links and text that I can change without making a new build ... What option is there to take this list of references remotely?

avatar image
0

Answer by digitalmkt · Jun 25, 2019 at 09:00 PM

I'm having the exactly same problem, did you solve it? Thanks.

I'm using firebaseDB to list all the links and name and more information, maybe this can help:

 FirebaseApp app = FirebaseApp.DefaultInstance;
             app.SetEditorDatabaseUrl("https://passportibiza-211918-82da1.firebaseio.com/");
             Debug.Log("Firebase DB Found");
 
             FirebaseDatabase.DefaultInstance
                             .GetReference("merchants")
                             //.StartAt(0)
                             .OrderByValue()
                             .ValueChanged += (object sender2, ValueChangedEventArgs e2) =>
                             {
                                 if (e2.DatabaseError != null)
                                 {
                                     Debug.LogError(e2.DatabaseError.Message);
                                 }
 
                                 if (e2.Snapshot != null && e2.Snapshot.ChildrenCount > 0)
                                 {
                                     foreach (var childSnapshot in e2.Snapshot.Children)
                                     {
 
                                         //Population the var with data from DB
                                         Debug.Log("Gathering Data");
 
                                         var address = childSnapshot.Child("address").Value.ToString();
                                         var cat = childSnapshot.Child("category").Value.ToString();
                                         //var incorp = childSnapshot.Child("incorporation").Value.ToString();
                                         var phone = childSnapshot.Child("phone").Value.ToString();
                                         var nameM = childSnapshot.Child("venue").Value.ToString();
                                         //var link = childSnapshot.Child("weblink").Value.ToString();
 
                                         List<string> link = new List<string>() { childSnapshot.Child("weblink").Value.ToString() };
 
                                         for (int i = 0; i < link.Count; i++)
                                         {
 
                                             Debug.Log("Lin URL array: " + link[i]);
                                             weblink(link[i]);
                                             ++i;
                                             break;
 
                                         }
 

                                         // Assigning UI elements and populating data from VARs
 
                                         addressField.text = address;
                                         catField.text = cat;
                                         phoneFIeld.text = phone;
                                         nameField.text = nameM;

                                         //Instantiating the UI elements based on DB entries
                                         uxPrefab.SetActive(true);
                                         GameObject merchants = Instantiate(uxPrefab, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
                                         merchants.transform.parent = GameObject.FindWithTag("content").transform;
                                         merchants.name = nameM;

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

82 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

Related Questions

how to change the maintexture from another scene? 1 Answer

WebGL WWW and Localhost CORS 0 Answers

Max String Length in WWW url's? 1 Answer

WWW.EscapeURL Not Work Well? 2 Answers

location of file downloaded with WWW 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