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 Super-Play-SP · Oct 18, 2016 at 05:01 AM · androidfiledownload

[Android] Download file.cs from Url & use it instead of original script.

Hi ^^

For Android application, wanted to apply downloadedFile.cs downloaded from Url instead of defaut script.

My script (DOESN'T WORK) :

 public void NouvellesAnnonces (){            
         WWW ww = new WWW("http://myWebSite/Ajouter.cs");
         StartCoroutine (NouvellesAnnoncesCor(ww));
     }
     IEnumerator NouvellesAnnoncesCor(WWW ww){
                     yield return ww;
             
                     #if UNITY_ANDROID //DOESN'T WORK
                     StreamWriter writer = new StreamWriter ("Assets/Scripts/AnnonceCherche.cs");
                     writer.WriteLine (ww.text);
                     writer.Close ();
                     #endif
                 }
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Naphier · Oct 18, 2016 at 07:17 AM

Scripts must be compiled for them to work in the application. They cannot be added at runtime.

Comment
Add comment · Show 5 · 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 Super-Play-SP · Oct 18, 2016 at 02:11 PM 0
Share

Is there a solution to read downloaded file as lines code ? [Android app]

avatar image tanoshimi · Oct 18, 2016 at 02:14 PM 0
Share

Actually, it is possible to dynamically compile during runtime, but it's not easy: https://community.unity.com/t5/Scripting/Compiling-C-at-runtime/td-p/2493879

avatar image Super-Play-SP tanoshimi · Oct 18, 2016 at 02:38 PM 0
Share

Thank you Tanoshimi, but I am french, that solution will be very hard to understand & apply it correctly.

avatar image Naphier tanoshimi · Oct 18, 2016 at 04:35 PM 0
Share

That's pretty neat. Actually doesn't look that hard, but it seems like a bad design choice and not really worth the effort. What are you trying to achieve here?

avatar image Super-Play-SP Naphier · Oct 18, 2016 at 08:06 PM 0
Share

I would like to update informations from my server via downloadedFile.cs. The content of downloadedFile.cs to be execute directly in the script compiled. Example of content of downloadedFile.cs :

StartCoroutine (PartiChiensChatsCor (0, "http://www.chatterieofmagicarcadia.fr/docs/infos/cream.jpg", "978494654654654", "20:14", "24 septembre 2016", "$$anonymous$$inou", "LOF / LOOF", "$$anonymous$$aine Coon", "Gourmand", "3", "Adulte", "$$anonymous$$âle", "Grand", "Oui", "Tatoué", "654987321654", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. $$anonymous$$aecenas sed tortor feugiat, sagittis ligula id, sollicitudin nulla. Nunc feugiat lectus vitae pulvinar fermentum. Praesent sed efficitur nulla. Nullam sapien arcu, bibendum in quam in posuere.", "1200", "Concepteur", "16000", "Paris", "000000000", "examplemail@gmail.com"));

Example of script in the Android app :

 public void NouvellesAnnonces (){            
         StartCoroutine ("NouvellesAnnoncesCor");
     }
     IEnumerator NouvellesAnnoncesCor(){
 
         WWW w = new WWW("http://myWebSite/downloadedFile.cs");
         yield return w;
                 //use the content of downloadedFile.cs like lines code
                 w.text;
     }


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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

insert my folder into an apk 0 Answers

Error occurs when trying to delete file in DCIM on Android 0 Answers

Wait for file download 1 Answer

WWW file download size 0 Answers

How to refer to internal json file on Android? 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