Skip to content

Instantly share code, notes, and snippets.

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

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / cpp-vs-notes.txt
Last active January 20, 2019 12:45
visual studio c++ notes
// how to add external library with .h files to your project?
- download the library somewhere on your pc, unzip
- in app properties, VC++ Directories, can set Include directories
// https://stackoverflow.com/questions/26142706/how-do-i-include-a-header-file-located-in-a-specific-folder-c
---------------------------------------------
ERROR:
fatal: 'submodule' appears to be a git command, but we were not able to execute it. Maybe git-submodule is broken?
@unitycoder
unitycoder / DrawBounds.cs
Last active February 12, 2025 04:14
Draw Bounds with Debug.DrawLine , Draw Box, Draw Runtime Gizmos
void DrawBounds(Bounds b, float delay=0)
{
// bottom
var p1 = new Vector3(b.min.x, b.min.y, b.min.z);
var p2 = new Vector3(b.max.x, b.min.y, b.min.z);
var p3 = new Vector3(b.max.x, b.min.y, b.max.z);
var p4 = new Vector3(b.min.x, b.min.y, b.max.z);
Debug.DrawLine(p1, p2, Color.blue, delay);
Debug.DrawLine(p2, p3, Color.red, delay);
@unitycoder
unitycoder / Internal-GUITextureClipText.shader
Last active January 20, 2019 12:45
UpdateShaders in Editor
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
Shader "Hidden/Internal-GUITextureClipText"
{
Properties { _MainTex ("Texture", 2D) = "white" {} }
CGINCLUDE
#pragma vertex vert
#pragma fragment frag
@unitycoder
unitycoder / RayBoxIntersectFast.cs
Last active October 5, 2022 21:07
RayBoxIntersect Faster than bounds.IntersectRay
// this is faster than unity *.bounds.IntersectRay(ray)
// original source https://gamedev.stackexchange.com/a/103714/73429
float RayBoxIntersect(Vector3 rpos, Vector3 rdir, Vector3 vmin, Vector3 vmax)
{
float t1 = (vmin.x - rpos.x) / rdir.x;
float t2 = (vmax.x - rpos.x) / rdir.x;
float t3 = (vmin.y - rpos.y) / rdir.y;
float t4 = (vmax.y - rpos.y) / rdir.y;
float t5 = (vmin.z - rpos.z) / rdir.z;
@unitycoder
unitycoder / wordpress php errors.txt
Last active October 18, 2021 11:17
Wordpress Internal Server Error 500
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
- your wp is too old for the new php version, try enable 5.4 from cpanel, then upgrade wp, then upgrade php
- server is missing mysql plugin (check from phpinfo, no mysql support modules)
https://phoenixnap.com/kb/your-php-installation-appears-to-be-missing-the-mysql-extension-which-is-required-by-wordpress
@unitycoder
unitycoder / wordpress-parse-error.txt
Created July 3, 2018 18:44
Wordpress Template "Parse error: syntax error, unexpected 'new'" after updating to php7.1
// error
Parse error: syntax error, unexpected 'new' (T_NEW)
// before
Search results for "<?php /* Search Count */ $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); _e('<strong>'); echo $key; _e('</strong>'); wp_reset_query(); ?>"
// after (removed &)
Search results for "<?php /* Search Count */ $allsearch = new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); _e('<strong>'); echo $key; _e('</strong>'); wp_reset_query(); ?>"
@unitycoder
unitycoder / poormans-clashroyalebot.au3
Last active February 11, 2022 23:10
Simple AutoIt BlueStacks Clash Royale Bot
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.5
Script Function:
BlueStacks ClashRoyale 2vs2 Bot
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
@unitycoder
unitycoder / detect-capslock.cs
Created August 6, 2018 07:53
Unity capslock detection
// https://www.reddit.com/r/Unity3D/comments/94z2aa/easy_capslock_detection/
[System.Runtime.InteropServices.DllImport("USER32.dll")] public static extern short GetKeyState(int nVirtKey);
bool IsCapsLockOn => (GetKeyState(0x14) & 1) > 0;
@unitycoder
unitycoder / LogSpamTest.cs
Created August 7, 2018 15:44
LogSpamTest
// measure debug.log with large loop
using UnityEngine;
public class LogSpamTest : MonoBehaviour
{
void Start()
{
var stopwatch = new System.Diagnostics.Stopwatch();
stopwatch.Start();
@unitycoder
unitycoder / DependencyWalker.txt
Created August 27, 2018 03:02
Check dependencies and export using DependencyWalker
http://www.dependencywalker.com/
- drag dll file to the window
- see main dependency tree list for depends (you always get references to gdi, user32, kernel etc..)
- see Exports window for exported function names