Skip to content

Instantly share code, notes, and snippets.

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

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / mono-simd.cs
Created May 23, 2018 09:37
using mono SIMD
// https://forum.unity.com/threads/no-more-cool-features-please-until-crippling-stuff-is-addressed.158652/page-7#post-1417716
using System.Diagnostics;
using System.Linq;
using Mono.Simd;
using UnityEngine;
using Debug = UnityEngine.Debug;
using Random = System.Random;
public class Test2 : MonoBehaviour
{
@unitycoder
unitycoder / ffmpeg Cheat Sheet.txt
Last active December 27, 2025 13:03
ffmpeg Cheat Sheet
// convert for streaming
@echo off
SETLOCAL EnableDelayedExpansion
for %%x in (mp3/*.mp3) do (
::echo "%%x"
call :Foo "%%x" "%%~nx"
)
goto End
@unitycoder
unitycoder / gortmp-windows-rtmp.txt
Last active June 22, 2018 15:33
Using gortmp as RTMP server in Windows
- install golang for windows https://golang.org/dl/
- download & unzip sources https://github.com/sevenzoe/gortmp
- run> go run main.go
- set OBS target to: rtmp://192.168.2.100/su_rtmp/mystreamkey
- view stream in VLC: rtmp://192.168.2.100/su_rtmp/mystreamkey
TROUBLESHOOTING
- "wirte video file error : mkdir /tmp/rtmp/su_rtmp: The system cannot find the path specified"
- Solution: Disable HLS from app.conf
@unitycoder
unitycoder / local-stream-server-win10.md
Last active March 3, 2026 22:45
Local RTMP Stream Server for Windows

https://obsproject.com/forum/resources/how-to-set-up-your-own-private-rtmfp-server-using-monaserver.153/ (copied here as a backup)

This article is inspired of the great guide of How to set up your own private RTMP server using nginx. https://obsproject.com/forum/resources/how-to-set-up-your-own-private-rtmp-server-using-nginx.50/

MonaServer is a tiny and scalable open source server which provide protocols RTMFP, RTMP, RTMPE, WebSocket and HTTP. Server applications are written in lua and clients just need to support one of these protocols.

The interest of MonaServer here is the RTFMP broadcast feature that avoid congestion (because it is a UDP protocol) unlike RTMP.

This guide will presents you an easy way to broadcast a video with OBS over RTMFP. Don't worry, you will not need to configure or write any code here :)

@unitycoder
unitycoder / udp-broadcast-receive.cs
Last active January 20, 2019 12:45
UDP Port Receive Broadcast Messages
// setup
this.broadcastAddress = new IPEndPoint(IPAddress.Any, 1234);
this.udpClient = new UdpClient();
this.udpClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
this.udpClient.ExclusiveAddressUse = false; // only if you want to send/receive on same machine.
listener.EnableBroadcast = true
// bind and assign callback
this.udpClient.Client.Bind(this.broadcastAddress);
this.udpClient.BeginReceive(new AsyncCallback(this.ReceiveCallback), null);
@unitycoder
unitycoder / KdTree.cs
Created April 29, 2018 13:26 — forked from ditzel/KdTree.cs
k-d Tree
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class KdTree<T> : IEnumerable<T>, IEnumerable where T : Component
{
protected KdNode _root;
protected KdNode _last;
protected int _count;
@unitycoder
unitycoder / split-string.cs
Created April 25, 2018 06:58
Split String with String in c#
var originalString = "asdfasdfasdfasdfunity";
var splitterString = "asd";
var splitted = originalstring.Split(new [] {splitterString}, System.StringSplitOptions.None);
@unitycoder
unitycoder / commandline-tips.txt
Last active June 4, 2025 18:32
Windows Command Line Tips cmd bat bash batch
// see what application has locked folder/file
perfmon.exe /res
// powershell, install ffmpeg
winget ffmpeg
// show what caused windows to wake up from sleep mode
powercfg -lastwake
// print errorcode after exe exists
@unitycoder
unitycoder / android-error-gvr.txt
Last active April 6, 2018 08:33
Android GVR 0.7 Build Error in Unity 2017.4.0f1
// caused by old GVR 0.7
FATAL EXCEPTION: main
java.lang.Error: FATAL EXCEPTION [main]
E/AndroidRuntime(10577): Caused by: java.lang.NoSuchMethodError: No direct method <init>(Landroid/content/ContextWrapper;)V in class Lcom/unity3d/player/UnityPlayer; or its super classes (declaration of 'com.unity3d.player.UnityPlayer' appears in /data/app/com.xyz.asdas-2/base.apk)
E/AndroidRuntime(10577): at com.google.unity.GoogleUnityActivity.onCreate(GoogleUnityActivity.java:114)
E/AndroidRuntime(10577): at android.app.Activity.performCreate(Activity.java:6289)
E/AndroidRuntime(10577): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
E/AndroidRuntime(10577): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
@unitycoder
unitycoder / negtest.shader
Created March 15, 2018 05:12
Invert Blend Shader Test
Shader "Unlit/NegTest"
{
Properties
{
// _MainTex ("Texture", 2D) = "white" {}
_Color ("Color", Color) = (1,0,0,1)
}
SubShader
{
Tags { "Queue"="Transparent" "RenderType"="Transparent" "IgnoreProjector"="True" }