Skip to content

Instantly share code, notes, and snippets.

View olegmrzv's full-sized avatar
🎲
Pew-Pew

Oleg Morozov olegmrzv

🎲
Pew-Pew
  • Chillbase
  • Russia, Saint-Petersburg
View GitHub Profile
@olegmrzv
olegmrzv / PlayerLoopCleaner.cs
Created April 4, 2024 13:07
PlayerLoop Disable Unity Modules
using System;
using UnityEngine;
using UnityEngine.LowLevel;
using UnityEngine.PlayerLoop;
public static class PlayerLoopCleaner
{
private static readonly Type[] typesToRemove = new Type[] {
typeof(EarlyUpdate.Physics2DEarlyUpdate),
// Physics 2D
public class SomeComponent : MonoBehaviour
{
private void Awake()
{
transform.position = new Vector3(1, 1, 1);
}
private void Start()
{
transform.position = new Vector3(2, 2, 2);
@olegmrzv
olegmrzv / SerializedDictionary.cs
Last active February 19, 2023 19:54
SerializedDictionary public version
[Serializable]
public class SerializedDictionary<K, V> : Dictionary<K, V>, ISerializationCallbackReceiver
{
[SerializeField]
private List<K> m_Keys = new List<K>();
[SerializeField]
private List<V> m_Values = new List<V>();
public void OnBeforeSerialize()
static Lifecycle() => Debug.Log(Prefix + "Static Constructor");
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] static void Subs() => Debug.Log(Prefix + "Subsystem Registration");
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)] static void AfterAsm() => Debug.Log(Prefix + "AfterAssembliesLoaded");
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)] static void BeforeSlash() => Debug.Log(Prefix + "Before Splash");
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] static void BeforeScene() => Debug.Log(Prefix + "BeforeScene");
private void Awake() => Debug.Log(Prefix + "Awake");
private void OnEnable() => Debug.Log(Prefix + "OnEnable");
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)] static void AfterScene() => Debug.Log(Prefix + "AfterSceneLoad");
[RuntimeInitializeOnLoadMethod] static void DefaultLog() => Debug.Log(Prefix + "RuntimeInit Default");
void Start() => Debug
using System;
using System.Diagnostics;
using NUnit.Framework;
using UnityEngine;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
namespace Tests
{
public unsafe class UnsafeUtilityTests
@olegmrzv
olegmrzv / Установка Outline VPN на Ubuntu 20.04.md
Created December 24, 2022 01:51 — forked from JohnyDeath/Установка Outline VPN на Ubuntu 20.04.md
Инструкция по развертыванию собственного VPN-сервиса на базе Outline VPN

Установка Outline VPN на Ubuntu 20.04

Outline VPN - это бесплатный инструмент с открытым исходным кодом, позволяющий развернуть собственную VPN на Вашем собственном сервере или на машине облачного провайдера. Подробную информацию Вы можете узнать здесь и здесь.

В своем составе имеет как графические инструменты, так и средства работы через командную строку. Позволяет использовать VPN как на настольных компьютерах, так и на мобильных устройствах.

Прежде чем начать

Вам нужен сервер. Да, его нужно арендовать, учитывая его местоположение. Например, если Вам нужно получать доступ к ресурсам, которые недоступны в текущем местоположении, но доступны, например, в Канаде, то смело арендуйте виртуальную машину в AWS, Digital Ocean или любом другом месте.

@olegmrzv
olegmrzv / HalfLambert.shader
Created July 16, 2021 23:26 — forked from hotcakesdeluxe/HalfLambert.shader
half lambert for stylized skin shading for unity
Shader "Custom/HalfLambert"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_RampTex ("Ramp (RGB)", 2D) = "white" {}
_BumpMap ("Bumpmap", 2D) = "bump" {}
_ShadowTint ("Shadow Color", Color) = (0, 0, 0, 1)
_RimColor ("Rim Color", Color) = (0.26,0.19,0.16,0.0)
using System;
using System.Threading;
using System.Threading.Tasks;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
async void Start() {
Debug.Log($"Hi 1 From MainThread {Thread.CurrentThread.ManagedThreadId}");
await Task.Run(async () => {
@olegmrzv
olegmrzv / RangeExtensions.cs
Created February 26, 2021 11:36
Range Extensions
using System;
using System.Collections;
using System.Collections.Generic;
// public class Program {
// public static void Main() {
// foreach(var i in 1..5) {
// Console.WriteLine(i);
// }
// }
@olegmrzv
olegmrzv / DisablePreviewPackageWarning.cs
Created November 1, 2020 21:14
Fix packages manager to show DOTS and etc
//https://forum.unity.com/threads/package-manager-showing-hidden-packages-script.995506/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEditor.PackageManager.UI;
using UnityEngine;
using Object = UnityEngine.Object;