Skip to content

Instantly share code, notes, and snippets.

View dmitry1100's full-sized avatar

Dmitry Viktorov dmitry1100

View GitHub Profile
@dmitry1100
dmitry1100 / TransformAllChildren.cs
Last active March 12, 2024 13:09
Unity Transform extension to enumerate all nested children deeply
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Fiftytwo
{
public static class TransformAllChildren
{
public static IEnumerable<Transform> AllChildren ( this Transform t )
@dmitry1100
dmitry1100 / CompleteKeyCodesList.cs
Last active May 24, 2022 05:22
The class demonstrates probably all possible string key codes in Unity that I've found inside UnityPlayer.dll binary. They can be used in Input.GetKey()
public static class CompleteKeyCodesList
{
public const int MaxJoysticksCount = 16;
public const int MaxJoystickButtonsCount = 20;
public readonly static string[] KeyboardCodes =
{
"backspace",
"delete",
"tab",
@dmitry1100
dmitry1100 / App.cs
Created October 10, 2018 22:19
Example on MonoBehaviour based singleton
using UnityEngine;
namespace Fiftytwo
{
public class App : MonoBehaviour
{
public static App Instance;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void RuntimeInitializeOnLoad()
@dmitry1100
dmitry1100 / TouchPreloadedAssets.cs
Created October 10, 2018 21:52
TouchPreloadedAssets is a workaround for Unity Editor to load Preloaded Assets as Unity Player does
using System.Reflection;
using UnityEditor;
namespace Fiftytwo
{
[InitializeOnLoad]
public class TouchPreloadedAssets
{
static TouchPreloadedAssets()
{
@dmitry1100
dmitry1100 / AppSettings.cs
Last active October 10, 2018 21:33
AppSettings ScriptableObject based singleton
using UnityEngine;
namespace Fiftytwo
{
[CreateAssetMenu]
public class AppSettings : ScriptableObject
{
public static AppSettings Instance;
public App AppPrefab;
@dmitry1100
dmitry1100 / app_icon.xml
Last active September 22, 2018 13:44
app_icon.xml and app_icon_round.xml content
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>