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 Elaiya · Sep 20, 2017 at 08:15 AM · unity 5build-errorandroid build

Instantiate not working on android build but it works on Unity player..My Question is there any problem with unityweb request..?

using System.Collections; using System.Collections.Generic; using UnityEngine; using System; using UnityEngine.Networking; public class NEWunitycall : MonoBehaviour {

 // Use this for initialization


 public static double TEST1;
 public static double TEST2i;
 bool hit;
 void Start () {
     
     StartCoroutine (LoadLoginInfo ());
 }
 
 // Update is called once per frame
 IEnumerator LoadLoginInfo ()
 {
     string    blue=(requestlatlong.ToString());

              byte[] rawData =System.Text.Encoding.UTF8.GetBytes(blue);
              string url = "http://192.002.2.652:1900/api/v1/user/objectlist";
 
     var www = new UnityWebRequest(url, "POST");

     www.SetRequestHeader("Content-Type", "application/json");
     www.SetRequestHeader("fbid", "997423570990");
     www.uploadHandler = (UploadHandler) new UploadHandlerRaw(rawData);
     www.uploadHandler.contentType= "application/json";
     www.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer();
     yield return www.Send();

     if (www.isNetworkError) {
         Debug.Log (www.error);
     } else {
         Debug.Log ("Data: " + www.downloadHandler.text);
         GameObject clone = Instantiate ((Resources.Load<GameObject>("prefab/C1")), transform.position = new Vector3 (0.07f, 1.44f, 10.49f), Quaternion.identity) as GameObject;
         clone.transform.SetParent (GameObject.FindGameObjectWithTag ("MainCamera").transform);
         Debug.Log ("second");
         Debug.Log("Load Login Info");
         hit=true;
     }

 }


}

Comment
Add comment · Show 4
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 hexagonius · Sep 20, 2017 at 09:00 AM 0
Share

you've got a Debug.Log for both cases of the www request. Where are you getting at?

avatar image Elaiya hexagonius · Sep 21, 2017 at 06:46 AM 0
Share

Else block.,the service is working fine but the object is not displaying on android build

avatar image hexagonius Elaiya · Sep 21, 2017 at 06:54 AM 0
Share

The code should work without the www request since it's not used for the spawn. Run the spawn on Android and try to get it to work. Use a console window where you run adb logcat -s Unity to see what the game is doing. You could also configure the game view to match the android device aspect and resolution to see if it them still is visible.

Show more comments

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

141 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 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 fix Gradle build errors when building android apk 0 Answers

Error: [Temp\StagingArea\AndroidManifest-main.xml 0 Answers

Failed to find Build Tools revision 29.0.0 - Android Builds 4 Answers

BuildFailedException: Incremental Player build failed! 2 Answers

Unity and Android. How yo manage build pipelines? 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