小编san*_*h.r的帖子

UnityWebRequest嵌入HTTP基本身份验证的用户+密码数据不适用于Android

下面的代码用于从我们自己的系统中托管的Thingworx服务器获取温度值.这在团结中非常有效.但是并非在andoird中,一旦生成了apk,它将不会从服务器获取任何数据,并且将建立连接.但是,它只是不会获取数据并将其放入文本网格中.

我正在使用统一5.4.1 32位.检查Android - 5.0.2和6.

using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
using System.Text.RegularExpressions;
using System;
using UnityEngine.UI;

public class  GETTempValue : MonoBehaviour {


public GameObject TempText;
static string TempValue;

void Start() 
{
    StartCoroutine(GetText());
}

IEnumerator GetText() 
{
    Debug.Log("Inside Coroutine");
    while (true) 
    {
        yield return new WaitForSeconds(5f);
        string url = "http://Administrator:ZZh7y6dn@*IP Address*:8080/Thingworx/Things/SimulationData/Properties/OvenTemperature/";

        Debug.Log("Before UnityWebRequest");
        UnityWebRequest www = UnityWebRequest.Get (url);
        yield return www.Send();
        Debug.Log("After UnityWebRequest");
        if (www.isError) {
            Debug.Log ("Error while Receiving: "+www.error);
        } else {
            Debug.Log("Success. Received: …
Run Code Online (Sandbox Code Playgroud)

c# networking android unity-game-engine

6
推荐指数
1
解决办法
7860
查看次数

标签 统计

android ×1

c# ×1

networking ×1

unity-game-engine ×1