The package is a little helper that makes communication between Unity and native platforms(iOS right now) easier and more convenient. It allows you to send and get a callback and transfer your data between unity and native code in a more convenient way, and efficient way.
For example, if you have some image that you want to use in Unity and get from the iPhone gallery, you don't need to send all data as an array of char bytes to unity, you can just save this data into a buffer which this package provides, this will return a hash for it, and then you just can get this data by this hash where you want. Under the hood, it will get back data from the buffer, get a pointer to it and size, and then just send this pointer to Unity, where it'll create an array of bytes, fill it with data from the pointer, and then will return this data to you.
- Navigate to the
Packages
directory of your project. - Adjust the project manifest file
manifest.json
in a text editor. - Ensure
https://registry.npmjs.org/
is part ofscopedRegistries
.- Ensure
com.stansassets
is part ofscopes
. - Add
com.stansassets.mobile
to thedependencies
, stating the latest version.
- Ensure
A minimal example ends up looking like this. Please note that the version X.Y.Z
stated here is to be replaced with the latest released version which is currently .
{
"scopedRegistries": [
{
"name": "npmjs",
"url": "https://registry.npmjs.org/",
"scopes": [
"com.stansassets"
]
}
],
"dependencies": {
"com.stansassets.mobile": "X.Y.Z",
...
}
}
- Switch back to the Unity software and wait for it to finish importing the added package.