Skip to content

Instantly share code, notes, and snippets.

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

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / Cryptography.cs
Created October 7, 2021 11:11
encrypt, decrypt files with AES. C#
// https://forum.unity.com/threads/c-encryption-decryption-class-that-works-good-in-a-project.394688/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Security.Cryptography;
using System.IO;
 
public class Cryptography : MonoBehaviour
{
    byte[] Encode(byte[] bytes, byte[] key, byte[] vector)
@unitycoder
unitycoder / Item.cs
Created October 7, 2021 10:47
How do I implement item durability and unique item ID to instantiated items
// https://forum.unity.com/threads/how-do-i-implement-item-durability-and-unique-item-id-to-instantiated-items.1179622/
class ItemTemplate : ScriptableObject
{
   public int baseDurability;
   public int baseDamage;
   // etc
}
 
class Item : MonoBehaviour
{
@unitycoder
unitycoder / ParallelGaussianBlur.cs
Created October 6, 2021 08:34
Parallel Gaussian Blur c#
// https://forum.unity.com/threads/contribution-texture2d-blur-in-c.185694/#post-7550443
using System.Collections.Generic;
using System.Threading.Tasks;
using Unity.Collections;
using UnityEngine;
 
[ExecuteInEditMode]
public class ParallelGaussianBlur : MonoBehaviour {
 
    // The MIT License
@unitycoder
unitycoder / UnityLogoShader.cs
Last active October 9, 2021 16:36
New Unity Logo using Surface Shader (and default cube)
// https://unitycoder.com/blog/2021/10/09/draw-new-unity-logo-using-surface-shader-default-cube/
Shader "Custom/UnityLogoShader"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
@unitycoder
unitycoder / CallNode.cs
Created October 5, 2021 09:12
Using Nethereum with Unity3D 2021
// https://forum.unity.com/threads/using-nethereum-with-unity3d-2021-1-22f1.1178602/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Nethereum.JsonRpc.UnityClient;
 
 
public class CallNode : MonoBehaviour
{
    // Start is called before the first frame update
@unitycoder
unitycoder / iPhone 13 mini.md
Last active June 3, 2024 11:00
iPhone13 mini notes and comparison with iPhone5

Whats worse

  • 13 is bigger, bulkier and heavier
  • has big notch area at top
  • camera lenses are so big that if you have your phone on the table, it tilts every time you click left side of the screen
  • Phone sides are slippery like plastic?
    • difficult to lift from table, easily drops especially since its so heavy and tilts due to camera lenses
  • Difficult reset button (need to press multiple buttons)
  • much worse battery live vs iphone5

Bugs

@unitycoder
unitycoder / URP_SimpleWater.shader
Created September 28, 2021 17:58
URP Simple Water Custom Shader (SRB batcher compatible)
// https://forum.unity.com/threads/can-anyone-give-me-a-quick-rundown-of-the-basics-of-a-handwritten-urp-shader-vs-in-built.757823/#post-7530506
Shader "URP/Unlit/SimpleWater"
{
    Properties
    {
        _Tint("Tint", Color) = (1, 1, 1, .5)
        _MainTex("Main Texture", 2D) = "white" {}
        _NoiseTex("Extra Wave Noise", 2D) = "white" {}
        _Speed("Wave Speed", Range(0,1)) = 0.5
        _Amount("Wave Amount", Range(0,1)) = 0.5
@unitycoder
unitycoder / Mobile360Cam.cs
Created September 27, 2021 11:09
Mobile 360 touch screen camera rotation
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// https://forum.unity.com/threads/touch-camera-rotation.659935/#post-4800458
public class Mobile360Cam : MonoBehaviour
{
public float ySpeed = 5;
Vector2 firstpoint, secondpoint;
@unitycoder
unitycoder / itchio-better-pixel-art.js
Last active October 9, 2021 19:15
GreaseMonkey plugin : better pixel art image viewer for itch.io
// ==UserScript==
// @name itch.io full screen image viewer
// @namespace https://unitycoder.com
// @description better image viewer lightbox for pixel art images
// @version 1.0
// @include https://*.itch.io/*
// @grant none
// @run-at document-start
// ==/UserScript==