Sign In Register

How can we help you today?

Start a new topic

listvirtualgoodsrequest c# example not compiling

the c# example on listvirtualgoodsrequest.html doesn't compile in unity.

I've added numerous comments to this docs page, all of them were refused or removed.

I've contacted support about it and they said they were gonna this.


Following code does NOT compile in unity...

 using GameSparks.Api;
    using GameSparks.Api.Requests;
    using GameSparks.Api.Responses;
    ...
    new ListVirtualGoodsRequest()
        .SetIncludeDisabled(includeDisabled)
        .SetTags(tags)
        .Send((response) => {
        GSData scriptData = response.ScriptData; 
        GSEnumerable<var> virtualGoods = response.VirtualGoods; 
        });
but if you change the last line in

 

GSEnumerable<ListVirtualGoodsResponse._VirtualGood> virtualGoods = response.VirtualGoods;

 Then it does.

I don't know why GameSparks put's uncompiling examples in their docs at first. And second i don't understand why this is not fixed yet or why my comments are removed or refused.


If i'm missing something about it i also like to know about it.


1 person has this problem

I am having the same issue and made a post DB but it went 5 days unanswered. I just want a simple list of the Virtual Goods a player owns so i can update the quantities in the game.  

 the answer is in my post

sorry for being so short earlier... i was on my phone...

 

replace the line:

GSEnumerable<var> virtualGoods = response.VirtualGoods;
into 
GSEnumerable<ListVirtualGoodsResponse._VirtualGood> virtualGoods = response.VirtualGoods;

i got it corrected. Thanks for the information. How do i go about pulling the data out of there? I want to assign the quantities of my virtual goods to text in my unity game.


Thanks, 

Can you forum mods please remove the delay in accepting forum posts, it's ridiculous.

 

i try once more to reply with an answer, then i give up on these forums...


 

                foreach (var v in virtualGoods)
                {
                        Debug.Log(v.Name+v.ShortCode+v.Currency1Cost);
                }

// you can find all parameters here: https://docs.gamesparks.com/api-documentation/request-api/store/listvirtualgoodsrequest.html

 

 

Can you email me solution? Joshua.hebert@swampwareinc.com
Joshua.hebert@ Swampwareinc .com
Just remove the spaces

Doc issues shouldn't really go here, it's quicker to submit the changes to the repository and Chris over there handles them within a day, and the fix is pushed usually within a week.

I am having a similar issue,

 GSEnumerable<var> challengeInstances = response.ChallengeInstances; will not compile.


I am trying to get a list of all the available challenges.


Any ideas?

Don't use var

 

Matteo,i posted the solution ;)

But it's amazing this is not fixed in the docs yet !

 


1 person likes this

Ward Dewaele, 

that worked!

They respond quite quickly to support tickets, but would have been quicker for me (and anyone else i guess) to just have a working documentation at disposition.

Login to post a comment