简体   繁体   English

选择 firebase 时,无法存储下拉值 label?

[英]Cant store dropdown value label when selected to firebase?

I am having some issues with my dropdown in unity, whenever I select a value in my dropdown and press on the button, it wont store that selected value to my firebase child (database).我的下拉列表存在一些问题,每当我在下拉列表中 select 一个值并按下按钮时,它不会将该选定值存储到我的 firebase 子(数据库)中。 Can anyone see what is going on with my code below?谁能看到下面我的代码发生了什么? thank you for your help.感谢您的帮助。 here is my code.这是我的代码。

     public async void FindMissingObject()
    {

        var httpWebRequest =
            (HttpWebRequest) WebRequest.Create("https://PROJECT_URL.firebaseio.com/missingObject/message.json");
        httpWebRequest.ContentType = "application/json";
        httpWebRequest.Method = "PUT";


        using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
        {



        string missingObjectCount = "{\"message\":\"" + _dropdown.captionText + "\"}}";
          streamWriter.Write(missingObjectCount);

        }

        var httpResponse = (HttpWebResponse) httpWebRequest.GetResponse();
        using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
        {
            var result = streamReader.ReadToEnd();
            Debug.Log(result);

        }


        SceneManager.LoadScene("Quiz");

    }



} 

It might be possible that the error stems from this line where you have one to many } braces and was rejected by the server:错误可能源于您有一对多}大括号并被服务器拒绝的这一行:

string missingObjectCount = "{\"message\":\"" + _dropdown.captionText + "\"}}";
//                                                                     here ^

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM