Skip to content

Instantly share code, notes, and snippets.

voxelbusters

Block or report user

Report or block voxelbusters

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@voxelbusters
voxelbusters / Demo.cs
Created Sep 27, 2019
Game Center External Authentication
View Demo.cs
IEnumerator VerifySignature(ExternalAuthenticationCredentials credentials)
{
WWWForm form = new WWWForm();
form.AddField("publicKeyUrl", credentials.iOSCredentials.PublicKeyURL);
form.AddField("timestamp", System.Convert.ToString(credentials.iOSCredentials.Timestamp));
form.AddField("signature", System.Convert.ToBase64String(credentials.iOSCredentials.Signature));
form.AddField("salt", System.Convert.ToBase64String(credentials.iOSCredentials.Salt));
form.AddField("playerId", NPBinding.GameServices.LocalUser.Identifier);
form.AddField("bundleId", NPBinding.Utility.GetBundleIdentifier());
@voxelbusters
voxelbusters / MailSharing.cs
Created Aug 30, 2019
CPNP 2.0 Mail Sharing
View MailSharing.cs
using UnityEngine;
using System.Collections;
using VoxelBusters.NativePlugins;
public class ExampleClass : MonoBehaviour
{
public void Start()
{
if (MailComposer.CanSendMail())
{
View ShareImageOnInstagram.cs
using VoxelBusters.InstagramKit;
void ShareImage(string filePath)
{
// Create Story Content Instance
StoryContent content = new StoryContent(filePath, false);
InstagramKitManager.Share(content, OnShareComplete);
}
private void OnShareComplete(bool success, string error)
@voxelbusters
voxelbusters / IsServiceAvailable.cs
Last active Jan 4, 2019
Instagram Kit for Unity
View IsServiceAvailable.cs
using VoxelBusters.InstagramKit;
public void IsAvailable()
{
bool isAvailable = InstagramKitManager.IsAvailable();
string message = isAvailable ? "Instagram Kit is available!" : "Instagram Kit is not available. Instagram app may not be installed.";
Debug.Log(message);
}
@voxelbusters
voxelbusters / CopyFileToPersistentPath.cs
Created Jan 4, 2019
Copy any file to Persistent Path
View CopyFileToPersistentPath.cs
// Namespace for using utility functions
using VoxelBusters.InstagramKit.Common.Utility;
// Path can be from local or web
private void DownloadFileToPersistentPath(string filePath, string targetFileName)
{
// Downloading if the file doesn't exist
if (!FileOperations.Exists (Application.persistentDataPath + "/" + targetFileName))
{
// Download file from given path
@voxelbusters
voxelbusters / SaveTextureToPersistentPath.cs
Last active Jan 4, 2019
Save Texture2D to Persistent Path
View SaveTextureToPersistentPath.cs
// Required Namesapce for using Utitlity Functions
using VoxelBusters.InstagramKit.Common.Utility;
// You need pass a texture2D which is marked as Readable in its inspector and pass saveName with extension. Ex: photo.png or photo.jpg
void SaveImage(Texture2D image, string saveName)
{
byte[] data = null;
if (saveName.EndsWith("png"))
{
data = ImageConversion.EncodeToPNG(image);
View Webview+LocalFileLoading.cs
#region Local File Loading
private void LoadHTMLStringContentsOfFile()
{
//Place the complete html folder in streaming assets (Ex:Assets/StreamingAssets/HtmlFoderName/HtmlFile.html)
string _folderName = "HtmlFolderName";
string _fileName = "HtmlFile.html";
StartCoroutine(LoadFromStreamingAssets(_folderName,_fileName));
}
View BillingProduct.cs
using UnityEngine;
using System.Collections;
namespace VoxelBusters.NativePlugins
{
/// <summary>
/// This provides unique access to a product which is purchasable. This encloses details for accessing different properties of a in-app product.
/// </summary>
[System.Serializable]
public class BillingProduct
View SelectiveRendering.cs
using UnityEngine;
using System.Collections;
//Ideally can use Layers but want to avoid as, max layers avaialble isn't a big number.
public class SelectiveRendering : MonoBehaviour
{
//Working version - Can expect as transform values are required for rendering. But not sure if this is optimal way.
[SerializeField]
private GameObject[] m_targetObjects;
You can’t perform that action at this time.