Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
✅
‏‏‎

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / CustomImportProcessor.cs
Created March 14, 2021 16:47
import user defined attributes from FBX files
using UnityEngine;
using UnityEditor;
using System.IO;
class CustomImportProcessor : AssetPostprocessor {
void OnPostprocessGameObjectWithUserProperties(GameObject go, string[] names, System.Object[] values) {
ModelImporter importer = (ModelImporter)assetImporter;
var asset_name = Path.GetFileName(importer.assetPath);
Debug.LogFormat("OnPostprocessGameObjectWithUserProperties(go = {0}) asset = {1}", go.name, asset_name);
string str = null;
@unitycoder
unitycoder / notificationlistmiddlemouse.js
Last active March 9, 2021 13:28
GreaseMonkey script: Add Middle Mouse Button Support into Asset Store Notifications Window Panel
// ==UserScript==
// @name Add Middle Mouse Button support to Notification list
// @namespace https://unitycoder.com
// @version 1
// @include https://assetstore.unity.com/*
// @run-at document-end
// @grant none
// ==/UserScript==
// info https://unitycoder.com/blog/2021/03/09/add-middle-mouse-button-support-to-assetstore-notifications-panel-greasemonkey-script/
@unitycoder
unitycoder / MultiMonitor.cs
Last active June 7, 2023 20:40
unity multimonitor setup
// https://docs.unity3d.com/Manual/MultiDisplay.html
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[DefaultExecutionOrder(-100)]
public class MultiMonitor : MonoBehaviour
{
int monitor_count;
@unitycoder
unitycoder / CSHttpClientSample.cs
Created March 8, 2021 08:18
c# PostAsync ttpClientSample
// from https://api-developer.vero.fi/api-details#api=TransferTax&operation=postSendReturn
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;
namespace CSHttpClientSample {
static class Program {
static void Main() {
@unitycoder
unitycoder / WorldNormalFromDepthTexture.shader
Created February 27, 2021 08:28 — forked from bgolus/WorldNormalFromDepthTexture.shader
Different methods for getting World Normal from Depth Texture, without any external script dependencies.
Shader "WorldNormalFromDepthTexture"
{
Properties {
[KeywordEnum(3 Tap, 4 Tap, Improved, Accurate)] _ReconstructionMethod ("Normal Reconstruction Method", Float) = 0
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
//MIT License
//Copyright (c) 2021 Felix Westin
//Source: https://github.com/Fewes/MinimalAtmosphere
//Ported to GLSL by Marcin Ignac
#ifndef ATMOSPHERE_INCLUDED
#define ATMOSPHERE_INCLUDED
// -------------------------------------
@unitycoder
unitycoder / NativeMesh-Plugin.cpp
Created February 26, 2021 13:57
native mesh plugin access vertices c++
// https://forum.unity.com/threads/access-mesh-vertices-in-c-plugin.435106/#post-6880418
#include <Windows.h>
#include <iostream>
// Namespaces
using namespace std;
// Macros
#define NT_MESH_API(retrun_type,func_name) extern "C" _declspec(dllexport) retrun_type func_name
@unitycoder
unitycoder / GeometryGrassPainter.cs
Created February 20, 2021 10:02
grass geometry shader and painter
// https://www.patreon.com/posts/grass-geometry-2-40077798
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
[ExecuteInEditMode]
@unitycoder
unitycoder / gist:199ff1dfd521bd9e9ae1e70e44e6bc5d
Last active September 25, 2021 08:14
[Fixefox GreaseMonkey Plugin Script] Fix Old Asset Store Links
// ==UserScript==
// @name Fix Old Asset Store Links
// @version 1
// @include https://www.assetstore.unity3d.com/*
// @grant none
// ==/UserScript==
// get current url
var URL = window.location.href;
@unitycoder
unitycoder / PanZoom.cs
Created February 15, 2021 10:31
mobile zoom and pan
// https://forum.unity.com/threads/zoom-and-pan-an-image.1048598/#post-6839018
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PanZoom : MonoBehaviour {
Vector3 touchStart;
public float zoomOutMin = 1;
public float zoomOutMax = 8;