Hi,
I've implemented an upload of a file to GS and added via an event 2 script data variables. This seems likes working, this is my code in Unity
new LogEventRequest().SetEventKey("UploadSave") .SetEventAttribute("uploadid", message.BaseData.GetString("uploadId")) .SetEventAttribute("uploadtime", "" + cur_time) .Send((response) => { if (response.HasErrors) { Debug.Log("Failed"); } else { Debug.Log("Successful"); } });
Now I want to read this ScriptData.
This is my cloud code:
Spark.setScriptData("UploadId", Spark.getPlayer().getScriptData("UploadId"));
Spark.setScriptData("UploadTime", Spark.getPlayer().getScriptData("UploadTime"));
And then I try do get this data:
new GameSparks.Api.Requests.LogChallengeEventRequest_GetUserData() .Send((responseuserdata) => { if (!responseuserdata.HasErrors) // check we dont have errors { //string data1 = responseuserdata.ScriptData.GetString("UploadId"); //string data2 = responseuserdata.ScriptData.GetString("UploadTime"); Debug.Log("Response Data: " + responseuserdata.ScriptData); } else { Debug.Log("Response Error: " + responseuserdata.Errors); } });
All I got is the Response Error:
GS: SEND:{"@class":".LogChallengeEventRequest","eventKey":"GetUserData","requestId":"636069780168047630_1"}
Response Error: GameSparks.Core.GSData
Any help would be awesome!
Cheers,
Armin
Hi Armin
In the code you provided you are calling a log challenge event but the code you have written is in a log event
If you change LogChallengeEventRequest_GetUserData to LogEventRequest_GetUserData you should get the correct response/
You can also use are test harness to test cloud code outside of the client like Unity.
Cheers
Katie
Hi Armin,
You can view any data sent to the server through the NoSQL module located on the GameSparks dashboard.
Just press the find tab and select the collection were you stored the file.
Does this answer your question?
- Tony.
Hi Katie,
that worked. Thanks a lot. Can you answer me another short question where I can find in the backend the uploaded files by the users?
Armin Toepper
Hi,
I've implemented an upload of a file to GS and added via an event 2 script data variables. This seems likes working, this is my code in Unity
new LogEventRequest().SetEventKey("UploadSave")
.SetEventAttribute("uploadid", message.BaseData.GetString("uploadId"))
.SetEventAttribute("uploadtime", "" + cur_time)
.Send((response) => {
if (response.HasErrors)
{
Debug.Log("Failed");
}
else
{
Debug.Log("Successful");
}
});
Now I want to read this ScriptData.
This is my cloud code:
Spark.setScriptData("UploadId", Spark.getPlayer().getScriptData("UploadId"));
Spark.setScriptData("UploadTime", Spark.getPlayer().getScriptData("UploadTime"));
And then I try do get this data:
new GameSparks.Api.Requests.LogChallengeEventRequest_GetUserData()
.Send((responseuserdata) => {
if (!responseuserdata.HasErrors) // check we dont have errors
{
//string data1 = responseuserdata.ScriptData.GetString("UploadId");
//string data2 = responseuserdata.ScriptData.GetString("UploadTime");
Debug.Log("Response Data: " + responseuserdata.ScriptData);
} else {
Debug.Log("Response Error: " + responseuserdata.Errors);
}
});
All I got is the Response Error:
GS: SEND:{"@class":".LogChallengeEventRequest","eventKey":"GetUserData","requestId":"636069780168047630_1"}
Response Error: GameSparks.Core.GSData
Any help would be awesome!
Cheers,
Armin
Hi Armin
In the code you provided you are calling a log challenge event but the code you have written is in a log event
If you change LogChallengeEventRequest_GetUserData to LogEventRequest_GetUserData you should get the correct response/
You can also use are test harness to test cloud code outside of the client like Unity.
Cheers
Katie
- Oldest First
- Popular
- Newest First
Sorted by PopularCustomer Support
Hi Armin
In the code you provided you are calling a log challenge event but the code you have written is in a log event
If you change LogChallengeEventRequest_GetUserData to LogEventRequest_GetUserData you should get the correct response/
You can also use are test harness to test cloud code outside of the client like Unity.
Cheers
Katie
1 person likes this
Customer Support
Hi Armin,
You can view any data sent to the server through the NoSQL module located on the GameSparks dashboard.
Just press the find tab and select the collection were you stored the file.
Does this answer your question?
- Tony.
Armin Toepper
Hi Katie,
that worked. Thanks a lot. Can you answer me another short question where I can find in the backend the uploaded files by the users?
Cheers,
Armin
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics