Skip to content

Instantly share code, notes, and snippets.

View dimmduh's full-sized avatar
🎮
Learning Unity

Dmitrii Dukhnich dimmduh

🎮
Learning Unity
View GitHub Profile
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3623)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3775)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2261)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at android.app.ActivityThread.main (ActivityThread.java:8107)
архипиздрит
басран
бздение
бздеть
бздех
бзднуть
бздун
бздунья
бздюха
бикса
@dimmduh
dimmduh / RenderTextureTo2DTexture.cs
Created February 25, 2020 18:26
unity - convert Render Texture To 2D Texture
private Texture2D RenderTextureTo2DTexture(RenderTexture rt)
{
var texture = new Texture2D(rt.width, rt.height, rt.graphicsFormat, 0, TextureCreationFlags.None);
RenderTexture.active = rt;
texture.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0);
texture.Apply();
RenderTexture.active = null;
@dimmduh
dimmduh / Standard2Sided.shader
Created February 10, 2020 04:21
Standard unity shader 2019.2 with cull off to render double sided
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
Shader "Standard2Sided"
{
Properties
{
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo", 2D) = "white" {}
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
@dimmduh
dimmduh / Utils.cs
Created December 24, 2019 15:11
Unity. Change material standard shader blend mode.
//see https://github.com/Unity-Technologies/UnityCsReference/blob/9034442437e6b5efe28c51d02e978a96a3ce5439/Editor/Mono/Inspector/StandardShaderGUI.cs
//blend mode 3 - transparent
public static void SetupMaterialWithBlendMode(Material material, int blendMode)
{
var assembly = Assembly.GetAssembly(typeof(Editor));
var type = assembly.GetType("UnityEditor.StandardShaderGUI");
var method = type.GetMethod("SetupMaterialWithBlendMode");
method.Invoke(null, new object[] {material, blendMode});
}
@dimmduh
dimmduh / MyStandaloneInputModule.cs
Last active June 17, 2019 15:27
Test virutal cursor for unity (2019.1)
using UnityEngine;
using UnityEngine.EventSystems;
public class MyStandaloneInputModule : StandaloneInputModule
{
public RectTransform m_VirtualCursor;
private Vector2 m_LastMousePosition;
private Vector2 m_MousePosition;
@dimmduh
dimmduh / EditorHelperHotkeys.cs
Last active June 5, 2019 15:54
Put somewhere in Editor folder
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
//version 0.2
@dimmduh
dimmduh / LayoutHotKey.cs
Created May 31, 2019 15:10
Unity reset layout by hotkey (default Ctrl + Shift + R). Put script to any Editor folder.
using System;
using System.IO;
using System.Reflection;
using UnityEditor;
public static class LayoutHotKey
{
const string layoutName = "Temp/autosave.wlt";
// % (ctrl), # (shift), & (alt)
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class NavMeshMerge : MonoBehaviour
{
public NavMeshMerge Instance;
public MeshFilter meshFilter;
@dimmduh
dimmduh / RotationHelper.cs
Created February 20, 2019 17:08
Unity - Rotate around point tool - test 1
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[InitializeOnLoad]
public class RotationHelper
{
private static bool enabled;