Skip to content

Instantly share code, notes, and snippets.

using System.IO;
using System.IO.Compression;
public static class ByteArrayExtensions
{
public static byte[] Compress(this byte[] raw)
{
using (MemoryStream memory = new MemoryStream())
{
using (GZipStream gzip = new GZipStream(memory,CompressionMode.Compress, true))
using System.Collections;
using UnityEngine;
[RequireComponent(typeof(SteamVR_TrackedController))]
public class DashController : MonoBehaviour
{
[SerializeField]
private float minDashRange = 0.5f;
[SerializeField]
private float maxDashRange = 40f;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
public class ImageLoader : MonoBehaviour
{
[SerializeField]
using UnityEngine;
public class GroundPlacementController : MonoBehaviour
{
[SerializeField]
private GameObject placeableObjectPrefab;
[SerializeField]
private KeyCode newObjectHotkey = KeyCode.A;
using UnityEngine;
using UnityEngine.UI;
public class ChooseRandomColor : MonoBehaviour
{
private void Start()
{
GetComponent<Button>().onClick.AddListener(ChangeImageColor);
}
using UnityEngine;
using UnityEngine.UI;
public class ChooseRandomColor : MonoBehaviour
{
public void ChangeImageColor()
{
GetComponent<Image>().color = RandomColor();
}
using UnityEngine;
public class SpriteScroll : MonoBehaviour
{
[SerializeField]
private float scrollSpeed = 1f;
private float rightEdge;
private float leftEdge;
private Vector3 distanceBetweenEdges;
using UnityEngine;
public class TriggerTester : MonoBehaviour
{
private SteamVR_TrackedObject trackedObject;
[SerializeField]
private bool trigger;
[SerializeField]
private bool trackpad;
// Assign out any additional controllers only after both left and right have been assigned.
//if (leftIndex != OpenVR.k_unTrackedDeviceIndexInvalid && rightIndex != OpenVR.k_unTrackedDeviceIndexInvalid)
{
for (uint deviceIndex = 0; deviceIndex < connected.Length; deviceIndex++)
{
if (objectIndex >= objects.Length)
break;
if (!connected[deviceIndex])
continue;
// Old Method
Debug.Log(string.Format("{0} handling puck held by changed - held by={1}",
character.gameObject.name,
puckHeldBy == null ? "" : puckHeldBy.gameObject.name));