Skip to content

Instantly share code, notes, and snippets.

Avatar

Dezső Zoltán zaki

View GitHub Profile
@zaki
zaki / ClearShaderProperties.cs
Created Jan 16, 2020
Clear unused properties left in the materials after changing shaders
View ClearShaderProperties.cs
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 Aug 9, 2018
A few aliases
View .localrc
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 Mar 5, 2018
Unity installer
View install.ps1
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]
View .editorconfig
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 Jun 22, 2016
Find missing scripts in unity prefabs
View FindMissingScripts.cs
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 Aug 29, 2015
Find missing script references in unity prefabs
View check_references.rb
#!/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
View Singleton.cs
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 Aug 29, 2015
virtual diamonds are a programmers best enemy
View pure_virtual.cpp
class Class1
{
public:
Class1() { dummy2(); }
virtual void dummy() = 0;
void dummy2() { dummy(); }
};
class Class2 : public Class1
{
@zaki
zaki / UnityInternalCompilerError.cs
Created Nov 25, 2014
Internal compiler error inducing typo in unity 5
View UnityInternalCompilerError.cs
// Compile error in unity 5
using UnityEngine;
public class Test
{
public enum TEST : byte
{
NONE = 0,
TEST = 1,
@zaki
zaki / merge_repos.sh
Created Oct 31, 2014
Merge two repositories
View merge_repos.sh
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