This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEditor; | |
using System.IO; | |
public class BuildWebGLDual | |
{ | |
[MenuItem("Build/WebGL Dual Build")] | |
public static void BuildGame() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function separateCircle(circle1:FlxSprite, circle2:FlxSprite):Bool | |
{ | |
var totalRadius:Float = circle1.width / 2 + circle2.width / 2; | |
var c1 = circle1.getMidpoint(FlxPoint.weak()); | |
var c2 = circle2.getMidpoint(FlxPoint.weak()); | |
var distanceSquared:Float = (c1.x - c2.x) * (c1.x - c2.x) + (c1.y - c2.y) * (c1.y - c2.y); | |
if (distanceSquared < totalRadius * totalRadius) | |
{ | |
var overlap:Float = totalRadius - Math.sqrt(distanceSquared); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class AxisInput : MonoBehaviour | |
{ | |
void Update() | |
{ | |
// Input Axis is a virtual joystick... unlike GetKey, it returns -1.0 - +1.0 | |
// e.g. holding your joystick to the left: -1.0f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.Video; | |
public class SmoothVideoPlaylist : MonoBehaviour { | |
// to smoothly cut between two videos, we need two VideoPlayers | |
// make sure you create two VideoPlayers and assign them in the Inspector | |
public VideoPlayer activeCam, otherCam; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mostly from https://github.com/dsoft20/psx_retroshader | |
// mixed with parts of https://github.com/keijiro/Retro3D | |
// under MIT license by Robert Yang (https://debacle.us) | |
Shader "Custom/VertexLit-Retro3D" { | |
Properties{ | |
_MainTex("Base (RGB)", 2D) = "white" {} | |
_Color("Color", Color) = (0.5, 0.5, 0.5, 1) | |
_GeoRes("Geometric Resolution", Float) = 40 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this code is under MIT License, by Robert Yang + others (credits in comments) | |
// a lot of this is based on http://wiki.unity3d.com/index.php?title=SkinnedMeshCombiner | |
// but I removed the atlasing stuff because I don't need it | |
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System; | |
using System.Collections; | |
[CustomPreview(typeof(YourCustomScriptableObject))] // THIS IS VERY IMPORTANT, this is so the editor knows what this is supposed to be previewing at all | |
public class SkinnedMeshObjectPreviewExample : ObjectPreview { | |
PreviewRenderUtility m_PreviewUtility; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class Cat : MonoBehaviour { | |
// declare a public variable, of type Transform, called "mouse" | |
public Transform mouse; | |
bool shouldIPlayASound = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using UnityEngine.VR; // you always need this to use special VR functions | |
public class VRUtility : MonoBehaviour { | |
// Use this for initialization | |
public void Start () { | |
// set render quality to 50%, sacrificing visual quality for higher FPS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using UnityEngine.VR; // we need this line here for InputTracking and VRSettings functions | |
// USAGE: put this on a thing you want the player to look at! | |
// this code will enable that thing to know if it is being looked at! | |
[RequireComponent (typeof(Collider)) ] // this thing needs a collider if we should look at it | |
public class RaycastTargetTrigger : MonoBehaviour { |
NewerOlder