question

Cricket_FeVR avatar image
Cricket_FeVR asked

How to print custom data with key value pairs of certain items from server side in C#?

How to print custom data with key value pairs of certain items from the inventory using C# from server side? Can someone paste the code? Where can I get these codes?

dataPlayer Inventory
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
JayZuo avatar image
JayZuo answered

In ItemInstance, you can find that CustomData is a Dict<String, String>. So in C#, it will be a Dictionary. If you are not clear with the usage, please check the docs, especially the Examples section.

6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Cricket_FeVR avatar image Cricket_FeVR commented ·

can u please post the code.. I'm new to this

0 Likes 0 ·
JayZuo avatar image JayZuo ♦ Cricket_FeVR commented ·

The Example shows how to print all data in a Dictionary like

        // When you use foreach to enumerate dictionary elements,
        // the elements are retrieved as KeyValuePair objects.
        Console.WriteLine();
        foreach( KeyValuePair<string, string> kvp in openWith )
        {
            Console.WriteLine("Key = {0}, Value = {1}", 
                kvp.Key, kvp.Value);
        }

So may I know what's your problem is? What's the code you are using? Please understand we can't not write all the code for you, if you have any problem, please share the detailed issue so that we can help you better.

0 Likes 0 ·
Cricket_FeVR avatar image Cricket_FeVR JayZuo ♦ commented ·

I need the Unity code

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.