Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8473621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:24:05+00:00 2026-06-10T17:24:05+00:00

I’m currently writing an In-App purchase plugin for Unity in Objective-C using pure C

  • 0

I’m currently writing an In-App purchase plugin for Unity in Objective-C using pure C as the API between unity and the objective-c code.

Introduction to the problem I am facing

The basic functionality already works. That is, I already have a very basic function call in my plugin to start a product request to the Apple App Store which can be called from Unity. In the unity script you simply call this method like this:

[DllImport ("__Internal")]
private static extern void RequestProducts(string[] productIdentifiers, int arrayCount);                          

public static void RequestProductData( string[] productIdentifiers )
{
    RequestProducts(productIdentifiers, productIdentifiers.Length);
}

This calls the C function which looks like this:

void RequestProducts(char* productIdentifiers[], int arrayCount)
{
    // Call the In-App purchase manager to initialize the product request
    [[InAppPurchaseManager sharedInAppPurchaseManager] RequestProductData:productIdentifierCollection];
}

Now I’ve omitted the part of the C function which takes the productIdentifiers array and converts it into an NSArray just to keep it simple and explain the problem I’m trying to solve.

Now the InAppPurchaseManager class is a singleton class. The RequestProductData method initiates the product request to the app store.

The Problem

When the StoreKit gives me a response back with all the products, this is where it starts to get tricky for me. I want to pass all the relevant data for each product retrieved back to the unity C# script so you can handle the data in your game. This means storing:

-The name of each product

-The description of each product

-The price of each product

An obvious solution would be to make a struct or class which contains this information and then make an instance for each product and put them all into an array.

The Question

Now the question is, how would I go about sending this array of complex data structures back to the Unity script? Unity’s official documentation mentions that you can send messages back to Unity using this method call:
UnitySendMessage(“GameObjectName1”, “MethodName1”, “Message to send”);

I got the call to work, but the obvious problem is that it only allows you to send strings.

So:

how would I go about sending arrays of complex data structures back to the Unity script? Is this even possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:24:07+00:00Added an answer on June 10, 2026 at 5:24 pm

    Follow up on my comment and your comment: if you want a robust solution, I would recommend that you check out this answer. If this is something performance critical, then you will have to get a lot more “manual” with your serialization. So how performance critical is this transfer of data?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I am currently running into a problem where an element is coming back from
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.