Skip to content

Instantly share code, notes, and snippets.

Avatar
🐤

Süleyman Yasir KULA yasirkula

🐤
View GitHub Profile
@yasirkula
yasirkula / ConvertTexturesToPNG.cs
Last active Jun 18, 2021
Convert all TGA, TIFF, PSD and BMP (customizable) Textures to PNG to reduce the project size without any quality loss in Unity
View ConvertTexturesToPNG.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using UnityEditor;
using UnityEngine;
using Debug = UnityEngine.Debug;
using Object = UnityEngine.Object;
@yasirkula
yasirkula / SingleColorTextureDetector.cs
Last active Jun 18, 2021
Find Textures with only a single color in a Unity project
View SingleColorTextureDetector.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
public class SingleColorTextureDetector : EditorWindow, IHasCustomMenu
{
@yasirkula
yasirkula / UnlitWithShadows.shader
Last active Mar 3, 2021
Unlit shader with shadows support for Unity's Built-in Render Pipeline
View UnlitWithShadows.shader
Shader "Unlit/Texture with Shadows"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Texture", 2D) = "white"
}
SubShader
{
Tags { "RenderType"="Opaque" "Queue"="Geometry" }
@yasirkula
yasirkula / DuplicateAssetDetector.cs
Last active May 13, 2021
Find duplicate assets in Unity
View DuplicateAssetDetector.cs
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Security.Cryptography;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using UnityEngine;
using Object = UnityEngine.Object;
@yasirkula
yasirkula / ShaderStripper.cs
Last active May 4, 2021
Stripping commonly unused shader variants in Unity's built-in render pipeline
View ShaderStripper.cs
//#define SHADER_COMPILATION_LOGGING
//#define SKIP_SHADER_COMPILATION
using System.Collections.Generic;
using UnityEditor.Build;
using UnityEditor.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
public class ShaderStripper : IPreprocessShaders
@yasirkula
yasirkula / SerializedPropertyRawValueGetter.cs
Last active Apr 30, 2021
Get/set the raw System.Object value of a SerializedProperty in Unity 3D
View SerializedPropertyRawValueGetter.cs
using System;
using System.Collections;
using System.Reflection;
using UnityEditor;
// Credit: http://answers.unity.com/answers/425602/view.html (I've only slightly modified the code)
public static class SerializedPropertyRawValueGetter
{
public static object GetRawValue( this SerializedProperty property )
{
@yasirkula
yasirkula / MultiScreenshotCapture.cs
Last active May 25, 2021
Capture multiple screenshots with different resolutions simultaneously in Unity 3D
View MultiScreenshotCapture.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace MultiScreenshotCaptureNamespace
{
internal static class ReflectionExtensions
@yasirkula
yasirkula / UnitypackageExtractor.cs
Last active Apr 30, 2021
Extract a .unitypackage to any directory (even outside the project folder) from within Unity
View UnitypackageExtractor.cs
#define STOP_EXTRACTION_WHEN_WINDOW_CLOSED
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
using System.Threading;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
@yasirkula
yasirkula / SlicedFilledImage.cs
Last active Jun 10, 2021
Combining UI Image's Sliced+Filled features together in Unity
View SlicedFilledImage.cs
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
#if UNITY_2017_4 || UNITY_2018_2_OR_NEWER
using UnityEngine.U2D;
#endif
using Sprites = UnityEngine.Sprites;
#if UNITY_EDITOR
@yasirkula
yasirkula / ScriptedAnimations.cs
Last active Mar 3, 2021
GC-free animation system for simple animations like scaling/moving objects or fading a UI element in Unity
View ScriptedAnimations.cs
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace ScriptedAnim
{
// Hide from Add Component menu
[AddComponentMenu( "" )]
public class ScriptedAnimations : MonoBehaviour
{