Skip to content

Instantly share code, notes, and snippets.

View AlexanderVott's full-sized avatar

Alexander Kiselev AlexanderVott

View GitHub Profile
@staggartcreations
staggartcreations / Rope.cs
Last active March 6, 2024 12:58
HingeJoint-based rope building component
using System;
using UnityEngine;
using UnityEngine.Serialization;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class RopeGenerator : MonoBehaviour
{
public Rigidbody attachementBody;
@Nesh108
Nesh108 / DiscordLogger.cs
Last active May 9, 2025 06:43
Unity Logger for posting Errors to Discord channel
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Networking;
// License: MIT
// Created by: Aceria_
// Edited by: Nesh108
// To use, add these to any MonoBehaviour:
// OnEnable: `Application.logMessageReceived += DiscordLogger.HandleLog;`
@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 )
private Dictionary<int, Action<Localisation.VariableSetter>> localisationVariableFuncs;
private void InitLocalisation() {
Localisation.Instance.DefaultVariableCallback = LocalisationVariableCallback;
localisationVariableFuncs = new Dictionary<int, Action<Localisation.VariableSetter>>{
{LocalisationConsts.Variables.ShotStyleBonusHash, setter => setter.SetValue(shotStyleBonuses)},
{LocalisationConsts.Variables.ShotPegScoreHash, setter => setter.SetValue(shotPegScore)}
};
// Iterate over all strings and pre-convert action tags to IDs so we only do this once
Localisation.Instance.ProcessMessages(InitLocalisationMessage);
@staggartcreations
staggartcreations / HeightmapToMesh.cs
Created June 27, 2019 18:05
Convert heightmap to mesh
// Staggart Creations
// http://staggart.xyz
using UnityEngine;
[ExecuteInEditMode]
public class HeightmapToMesh : MonoBehaviour
{
public MeshFilter meshFilter;
public Texture2D heightmap;
@to-osaki
to-osaki / ScriptedImporterJsonToScriptableObject.cs
Created May 20, 2019 15:29
ScriptedImporter json to ScriptableObject
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor.Experimental.AssetImporters;
using System.IO;
using UnityEditor;
// refer to
// https://docs.unity3d.com/ja/current/Manual/ScriptedImporters.html
// https://github.com/unity3d-jp/AlembicForUnity/blob/master/com.unity.formats.alembic/Editor/Importer/AlembicImporter.cs
@randalfien
randalfien / MarkUnused.cs
Last active October 3, 2024 01:52
Unity Mark Unused Assets
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEngine;
public class MarkUnused
{
private const string UnusedLabel = "Unused"; // All unused assets will be tagged with this label
@PathogenDavid
PathogenDavid / FixUpNullsBehaviour.cs
Created November 21, 2018 20:25
Workaround for Unity's weird behavior of deserializing some null object references as zombies instead of null - https://github.com/dotnet/csharplang/issues/2020
//----------------------------------------------------------------------------------
// Copyright (c) 2018 David Maas
//
// Permission to use, copy, modify, and/or distribute this software for any purpose
// with or without fee is hereby granted.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
#if CSHARP_7_OR_LATER
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
using System;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement;
namespace UniRx.Async
{
@phi-lira
phi-lira / PerfTracker.cs
Created March 16, 2018 18:02
Performance Tracker scripts.
// Script made by aleks01010101
// Slightly modified
// Displays avg and median ms + frames sampled during clipLenght
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PerfTracker : MonoBehaviour {
public float clipLength = 20.0f;