Skip to content

Instantly share code, notes, and snippets.

View zaki's full-sized avatar

Dezső Zoltán zaki

View GitHub Profile
@zaki
zaki / ClearShaderProperties.cs
Created January 16, 2020 10:14
Clear unused properties left in the materials after changing shaders
using System.Text;
using UnityEngine;
using UnityEditor;
namespace Friday.Utilities
{
public class ClearShaderProperties : EditorWindow
{
private Material m_selectedMaterial;
private SerializedObject m_serializedObject;
@zaki
zaki / .localrc
Created August 9, 2018 01:14
A few aliases
alias grhod='git reset --hard origin/develop; git clean -fd; git submodule update --recursive'
alias remod='git reset --hard; git clean -fd; git checkout -f develop; git remote update origin --prune; git reset --hard origin/develop; git clean -fd; git submodule update --recursive'
alias l='ls -la'
compdef g=git
__git_complete g __git_main
__git_complete grh _git_complete_refs
function endreview() {
gitdir=$(git rev-parse --show-toplevel)/.git
review_file=${gitdir}/review-branch
@zaki
zaki / install.ps1
Last active March 5, 2018 03:26
Unity installer
function Check-Version()
{
$file = $args[0]
$lines = Get-Content "$file" -TotalCount 2
return $lines[0].Trim(), $lines[1].Trim()
}
function Install-Component()
{
$PATH = $args[0]
@zaki
zaki / .editorconfig
Last active February 7, 2018 09:00
Unity Setup
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
[*.{cs,py,shader,cginc,xml}]
@zaki
zaki / FindMissingScripts.cs
Created June 22, 2016 03:52
Find missing scripts in unity prefabs
using UnityEngine;
using UnityEditor;
using UnityEngine.SceneManagement;
using UnityEditor.SceneManagement;
using System;
public class FindMissingScriptsEditor : EditorWindow
{
[MenuItem("Window/Utilities/Find Missing Scripts")]
public static void FindMissingScripts()
@zaki
zaki / check_references.rb
Last active August 29, 2015 14:13
Find missing script references in unity prefabs
#!/bin/env ruby
guids = {}
dir = File.dirname(__FILE__) + "/../../unity/Assets/**/*.meta"
Dir.glob(dir, File::FNM_DOTMATCH).each do |script|
if File.read(script) =~ /guid: ([\h]+$)/m
guids[$1] = $1
end
end
@zaki
zaki / Singleton.cs
Created December 3, 2014 02:40
Singleton
namespace Friday
{
public class Singleton<T> where T : class, new()
{
protected static T instance = null;
public static T Instance
{
get
{
@zaki
zaki / pure_virtual.cpp
Last active August 29, 2015 14:10
virtual diamonds are a programmers best enemy
class Class1
{
public:
Class1() { dummy2(); }
virtual void dummy() = 0;
void dummy2() { dummy(); }
};
class Class2 : public Class1
{
@zaki
zaki / UnityInternalCompilerError.cs
Created November 25, 2014 03:32
Internal compiler error inducing typo in unity 5
// Compile error in unity 5
using UnityEngine;
public class Test
{
public enum TEST : byte
{
NONE = 0,
TEST = 1,
@zaki
zaki / merge_repos.sh
Created October 31, 2014 10:51
Merge two repositories
mkdir repo_merge
cd repo_merge
git clone zaki/test_server
git clone zaki/test_client
## PREPROCESS SERVER
cd test_server
git remote rm origin # precaution