Skip to content

Instantly share code, notes, and snippets.

@RhetTbull
RhetTbull / uti.csv
Created June 28, 2021 04:10
A CSV list of Apple macOS Universal Type Identifiers (UTIs) and associated extensions & MIME types. Generated programmaticaly with calls to UTTypeCreatePreferredIdentifierForTag (https://developer.apple.com/documentation/coreservices/1448939-uttypecreatepreferredidentifierf)
extension UTI preferred_extension MIME_type
c public.c-source c None
f public.fortran-source f None
h public.c-header h None
i public.c-source.preprocessed i None
l public.lex-source l None
m public.objective-c-source m None
o public.object-code o None
r com.apple.rez-source r None
s public.assembly-source s None
@LotteMakesStuff
LotteMakesStuff / 1.md
Last active January 5, 2023 20:54
UPM: How to make a custom package

UPM: How to make a custom package So, Unity has this shiny new package manager, and you have code you want to share between projects - wouldn't it be great if we could bundle up our shared code and plug it into all the projects that need it? Let's figure out how to make our own Package!


Todo

  • Modify the project manifest
  • Make a package manifest
  • Package the manifest up with some test code
  • Try it out in Unity!

@Naphier
Naphier / UGuiTextToTextMeshPro.cs
Created January 4, 2017 15:23
Unity3D Editor Tool to convert Unity GUI Text objects to Text Mesh Pro Text Objects
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
using TMPro;
using TMPro.EditorUtilities;
public class UGuiTextToTextMeshPro : Editor
{
[MenuItem("GameObject/UI/Convert To Text Mesh Pro", false, 4000)]
static void DoIt()
@QXSoftware
QXSoftware / MeshRendererInspector.cs
Last active October 20, 2023 03:45
A unity mesh renderer inspector to view and modify renderer's sorting layer and material's render queue.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(MeshRenderer), true)]
public class MeshRendererInspector : Editor
{
@radiatoryang
radiatoryang / SkinnedMeshObjectPreviewExample.cs
Last active October 7, 2022 10:07
An example of a custom ObjectPreview rendering out a SkinnedMesh for Unity Editor C#... I used it for facial expressions and blendshape editing, you might want to use it for something else. I hereby place it under MIT License. Full write-up here: http://www.blog.radiator.debacle.us/2016/06/working-with-custom-objectpreviews-and.html
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
[CustomPreview(typeof(YourCustomScriptableObject))] // THIS IS VERY IMPORTANT, this is so the editor knows what this is supposed to be previewing at all
public class SkinnedMeshObjectPreviewExample : ObjectPreview {
PreviewRenderUtility m_PreviewUtility;
@nemotoo
nemotoo / .gitattributes
Last active July 20, 2024 19:28
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@jringrose
jringrose / InspectorReadOnly.cs
Last active December 21, 2016 07:56
Use this InspectorReadOnly attribute for public fields that you want to easily inspect in the editor without allowing modifications. InspectorReadOnlyDrawer needs to be inside an Editor folder.
using System;
using UnityEngine;
// Usage:
//
// [InspectorReadOnly]
// public float someValue = 5f;
//
public class InspectorReadOnly : PropertyAttribute {
#include <iostream>
#include <fstream>
#include <memory>
#include <string>
#include <algorithm>
void process_crypt_table(unsigned *crypt_table)
{
for (auto i = 0; i < 227; i++)
{
@mandarinx
mandarinx / optimizations.md
Last active September 28, 2023 03:51
Unity3D optimization tips

Unity3D optimization tips

Some code allocates memory when running in the editor and not on the device. This is due to Unity doing some extra error handling so possible error messages can be output in the console. Much of this code is stripped during build. It's therefore important to profile on device, and do it regularly.

Optimizations often makes code more rigid and harder to reason. Don't do it until you really need to.

When profiling, wrap methods or portions of a method in Profiler.BeginSample(string name) and Profiler.EndSample() to make them easier to find in the profiler.

public class SomeClass {