Passing Data Objects to Unity Scaleform AS3

842 Views Asked by At

What I've read says to use reflection between C# and Scaleform. This works for the most part for triggering interactions and functionality between the MVC, but I was just wondering what would be the best method for transferring a data object from the game to the UI.

The objective is to have the UI handle as much of the display functionality as possible. This question is in the context of a Unity game where resources are limited and systems should be as compartmentalized as possible.

1

There are 1 best solutions below

0
On BEST ANSWER

You can't pass a raw chunk of data to Scaleform and receive it as a "naked" object (e.g. {id:0, name:"foo", x:100, y:100} and so on). However, you CAN create corresponding data container types in both C# and AS3 and transfer data that way. This is accomplished using the value.ConvertFromAsObject method and the Value.ConvertToAsObject static method.

In the Scaleform 4.2 API, this information can be located in the Scaleform Unity Integration Guide, section 8.1.6, "Passing Objects between C# and AS3."

Alternately, you might look at the implementations of those functions in SFValue.cs and use that as a guideline for developing your own data transfer techniques using the DirectAccess API.