Skip to content

Instantly share code, notes, and snippets.

@AkhmadMax
AkhmadMax / NumbersHelper.cs
Created May 19, 2017 11:21
Возвращает слова в падеже, зависимом от заданного числа
public static class NumbersHelper
{
/// <summary>
/// Возвращает слова в падеже, зависимом от заданного числа
/// </summary>
/// <param name="number">Число от которого зависит выбранное слово</param>
/// <param name="nominativ">Именительный падеж слова. Например "день"</param>
/// <param name="genetiv">Родительный падеж слова. Например "дня"</param>
/// <param name="plural">Множественное число слова. Например "дней"</param>
/// <returns></returns>
using UnityEngine;
using System.Collections;
public class HiResScreenShots : MonoBehaviour {
public int resWidth = 2550;
public int resHeight = 3300;
private bool takeHiResShot = false;
public static string ScreenShotName(int width, int height) {
@AkhmadMax
AkhmadMax / Photo.cs
Created April 14, 2017 06:47
Zooms Photo In and Out
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using DG.Tweening;
using System.Collections;
public class Photo : MonoBehaviour, IPointerUpHandler
{
Texture rawImage;
using UnityEngine;
public static class VisibilityCheck
{
/// <summary>
/// Counts the bounding box corners of the given RectTransform that are visible from the given Camera in screen space.
/// </summary>
/// <returns>The amount of bounding box corners that are visible from the Camera.</returns>
/// <param name="rectTransform">Rect transform.</param>
/// <param name="camera">Camera.</param>
/// ScaleRelativeToCamera.cs
/// Hayden Scott-Baron (Dock) - http://starfruitgames.com
/// 19 Oct 2012
///
/// Scales object relative to camera.
/// Useful for GUI and items that appear in the world space.
using UnityEngine;
using System.Collections;
@AkhmadMax
AkhmadMax / DetectLeaks.cs
Created July 1, 2014 11:28
Script helps to find if Unity leaves any assets in memory, what causes overflow. Usually it happens after creating assets in runtime.
// Script helps to find if Unity leaves any assets in memory, what causes overflow.
// Usually it happens after creating assets in runtime.
using UnityEngine;
public class DetectLeaks : MonoBehaviour
{
void OnGUI()
{
if (GUILayout.Button("Unload Unused Assets"))
@AkhmadMax
AkhmadMax / FindMissingScripts.cs
Created July 31, 2013 12:48
Allows you to add a search a Unity project for all instances of missing mono script.
using UnityEngine;
using UnityEditor;
public class FindMissingScripts : EditorWindow {
[MenuItem("Window/FindMissingScripts")]
public static void ShowWindow()
{
EditorWindow.GetWindow(typeof(FindMissingScripts));
}

Git And Unity 3.5

This guide has been written to serve as a reference to setting up maintaining a Git repository of a shared Unity 3.5 project. It's a culmination of official documentation articles, archived forum threads, and general experimentation.

A Note on Existing Projects

This guide has not been tested on any existing project. There's a possibility that because a scene file isn't initially tracked, it may prove to be incompatible, or it is assigned a metadata file and tracked by Unity like any other file.


@AkhmadMax
AkhmadMax / EventDispatcher.cs
Created May 30, 2013 11:15
C# built-in event system used in Unity3D Author: Bartek Drozdz Reference: http://www.everyday3d.com/blog/index.php/2010/10/04/c-events-and-unity3d/
// C# built-in event system used in Unity3D
//
// Author: Bartek Drozdz
// Reference: http://www.everyday3d.com/blog/index.php/2010/10/04/c-events-and-unity3d/
using UnityEngine;
public class EventDispatcher : MonoBehaviour
{
public delegate void EventHandler(GameObject e);
@AkhmadMax
AkhmadMax / Singleton.cs
Last active December 17, 2015 21:38
Script represents a simple base class for Singleton behaviors
// Script represents a simple base class for Singleton behaviors
// usage:
// public class SomeClass : Singleton<SomeClass>
using UnityEngine;
public class Singleton<T> : MonoBehaviour where T : MonoBehaviour
{
protected static T instance;