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 Yuemari · Mar 17, 2016 at 11:38 PM · webglstringbrowser communication

How to send large strings from Unity WebGL to javascript browser function

Hi,

I'm using the method described here: WebGL to browser to pass 2 very large strings (1024x1024 textures converted to Base64String) as is a requirement from my client to a function in the browser javascript, but when I print the received strings via "console.log" they aren't complete as if they got cutted.

Any hint in how to solve this problem?

Thanks in advance.

Here is the code Im using in my WebGL plugin:

 Save: function(texture1, texture2, customData)
     {
         window.save(Pointer_stringify(texture1) ,Pointer_stringify (texture2),Pointer_stringify (customData));
     }

and here is the current code in my browser javascript:

 function save(t1, t2, customData)
     {
         console.log(t1);
         console.log(t2);
         console.log(customData);
     }

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 Bunny83 · Mar 18, 2016 at 05:49 AM 1
Share

Some things you should clear up:

  • What is "very large" for you? 200? 2k? 200k? 20$$anonymous$$?

  • What information does the string contain and in which format? Any special characters like "\0"?

  • Are you sure that it's not just the console that has a displaylimit for a single line? For example Unity's console has a limit of 65k. If you log something larger it gets truncated. The same limit holds true for most immediate mode gui controls in Unity: GUI.Label / GUI.TextField / GUI.TextArea / ...

edit
Just read that you use base64 for 1024² images. Do you store them as raw data? or do you store them as png? If they are RGBA images that would mean you need at least 4 bytes per pixel. Storing them uncompressed would be total overkill.

avatar image Yuemari · Mar 18, 2016 at 03:01 PM 0
Share

Hi @Bunny83,

Thanks for the reply, I'm not sure how many characters does it contain but but if I remember well it was around 25k, as it is converted from a bytes array to base64 string, I cant control whether there are special characters or not. And to pass it to the browser in that format is my client requirement, they then upload it to their servers and do other things with it. I'm not sure if the console limit is what I'm looking at right now with this problem, will do some tests and be back answer. At least they are just RGB.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by coolraiman · May 03, 2016 at 01:50 PM

maybe you could fragment the string in multiple part of a fixed size just like you would split a winrar archive in multiple volume and then display the log of each part.

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

43 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

Related Questions

Import/Export of save file string 0 Answers

How can I get a string to work as the key to a dictionary filled with the text of a www object? 0 Answers

Unity WebGL calling a function from a jslib file in JavaScript(Vue) 0 Answers

WebGL build callback on tab close or browser quit. 1 Answer

WebGL: Interacting with browser scripting unable to call java script method from C# 2 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