Skip to content

Instantly share code, notes, and snippets.

@GeorgiyRyaposov
GeorgiyRyaposov / ShakeRoutine.cs
Last active March 25, 2017 10:35
Shake routine
public Vector3 shakePower = new Vector3(0.03f, 0.03f, 0.03f);
public float shakeDuration = 1f;
private IEnumerator ShakeRoutine()
{
for (var t = 0f; t < shakeDuration; t += Time.unscaledDeltaTime)
{
var offset = transform.rotation * Vector3.Scale(Random.onUnitSphere, shakePower);
transform.position += offset;
@GeorgiyRyaposov
GeorgiyRyaposov / DataManager.cs
Last active August 5, 2017 10:42
Save\load data with BinaryFormatter\json in Unity3d for builded game or in the editor
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using UnityEngine;
//to make BinarySerializer work at iOS devices add somewhere in awake:
//System.Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "yes");
namespace Assets.Scripts.Tools
{