Skip to content

Instantly share code, notes, and snippets.

@prime31
prime31 / TransitionKit demo scene code
Created November 8, 2014 01:05
TransitionKit demo scene code. The basic idea is that the transitionWithDelegate method takes in an object that handles the transitions. This can be a standard class or a MonoBehaviour subclass (so that you can modify properties in the inspector) as in the third button. Transitions can change scenes if they want to or just obscure the current sc…
void OnGUI()
{
if( GUILayout.Button( "Fade to Scene" ) )
{
var scene = Application.loadedLevel == 0 ? 1 : 0;
TransitionKit.transitionWithDelegate( new FadeTransition( Color.black, 0.5f, 0.2f, scene ) );
}
if( GUILayout.Button( "Pixelate to Scene with Random Scale Effect" ) )
@prime31
prime31 / AndroidManifest.xml
Created October 13, 2014 19:27
AndroidManifest.xml example for testing Twitter changes
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
@prime31
prime31 / Vector3Editor.cs
Last active August 23, 2018 20:27
Ever get tired of creating piles of GameObjects just because you want a Vector3 position? Those days are over. The Vector3Editor will let you edit single Vector3 properties and arrays of Vector3's without having to create a plethora of GameObjects.
// Usage:
// - stick the Vector3Editor.cs file in the Editor folder of your project
// - create a class with a Vector3 or Vector3[] property (you probably already have plenty of them. The WarpZone class below is a simple example)
// - create an editor script for any the class that you want to be able to edit extending Vector3Editor (see WarpZoneEditor below)
// - in OnEnable simply call setup() with your property names and optional labels
using UnityEngine;
using UnityEditor;
@prime31
prime31 / ParticleFlock.cs
Created May 1, 2014 17:42
Simple (unoptimized!) particle flock. Stick it on a GameObject with a ParticleSystem and play with inspector for some interesting results. Clicking anywhere on screen will set the target position for all boids.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[RequireComponent( typeof( ParticleSystem ) )]
public class ParticleFlock : MonoBehaviour
{
public Vector3 targetPosition;
public int totalBoids = 15;
@prime31
prime31 / Activity Sharing Methods
Last active June 20, 2023 03:04
This is a list of all the available methods for the prime[31] Unity Activity sharing system.
public static void onCreate( Bundle savedInstanceState )
public static void onActivityResult( int request, int response, Intent data )
public static void onRequestPermissionsResult( int requestCode, String[] permissions, int[] grantResults )
public static void onNewIntent( Intent intent )
public static void onStart()
@prime31
prime31 / Loading turn-based matches comparison
Last active August 29, 2015 13:58
One example (of many, many examples) that shows the difference in API design between Apple and Google. This example shows the code required to load a list of turn based matches.
// Apple API for loading all your turn-based matches
[GKTurnBasedMatch loadMatchesWithCompletionHandler:^( NSArray *matches, NSError *error )
{
// there is either an error or a result. nice and simple.
if( error )
log( "print a useful error: " + error );
else
log( "the matches are here: " + matches );
}];
void Awake()
{
var chinese = "我是一个中国人的一句";
Debug.Log( "chinese: " + chinese );
}
@prime31
prime31 / Sriracha Sauce
Created February 9, 2014 02:19
Sriracha Sauce recipe
Ingredients:
- 1.5 lbs of hot peppers. Mix and match whatever you want: jalepenos, anaheims, haberneros, etc. If you can get at least 0.5 lb ripened red I recommend doing so but if you cant all green peppers works as well. If you don't want it too hot don't add all the seeds.
- 8 T honey (preferably local, raw honey. If you don't really worry about what you eat you can use suger/brown sugar)
- 6 cloves of garlic
- 3 t salt
- 1/2 cup vinegar (preferably raw Apple Cider vineger. If you don't really worry about what you eat you can use white vinegar)
@prime31
prime31 / prime[31] + Vuforia
Last active September 8, 2016 17:50
Activity override system that will work with Vuforia. Note that this is provided as-is and we do not provide support for working with Vuforia.
- download the jar file from here: https://mega.co.nz/#!pd81gYBA!ui33ktU2xDqmcsYOv5oSZ6v-niPp1ofwh02naT7Vqbs Note that anytime you import any other plugins make sure that file doesn't get overwritten!
- overwrite the file with the same name in the Plugins/Android folder with the downloaded jar
- generate an AndroidManifest.xml file
- add the required permissions for Vuforia to the generated AndroidManifest.xml (see their docs for the details)
@prime31
prime31 / Facebook Post Process Fix
Last active December 22, 2015 04:29
Fixes Facebook's post build system to make it compatible with ours
Open the FacebookPostProcess.cs file and find the following line:
[PostProcessBuild]
Change the line to be:
[PostProcessBuild( 999 )]