Skip to content

Instantly share code, notes, and snippets.

View jackyyang09's full-sized avatar

Brogrammist jackyyang09

View GitHub Profile
@mstevenson
mstevenson / CreateAssetFromScript.cs
Created February 6, 2013 22:39
Creates an on-disk instance of a Unity ScriptableObject. To install, copy CreateAssetFromScript.cs into an Editor folder in your Unity project. To use, first select a script that inherits from ScriptableObject in the Project window, then select the menu Assets > Create Asset From ScriptableObject.
using UnityEngine;
using UnityEditor;
using System;
public class CreateAssetFromScript : Editor {
[MenuItem("Assets/Create Asset From Manager Script", false, 10000)]
public static void CreateManager ()
{
ScriptableObject asset = ScriptableObject.CreateInstance (Selection.activeObject.name);

How to Use?

GUIStyle mystyle = new GUIStyle("some string from the list below");


UnityEditor.ConsoleWindow.Constants

  • "CN Box"
  • "Button"
@Ikalou
Ikalou / git_and_unity.md
Last active April 22, 2024 04:01
Git and Unity

EDIT: this is an old post and a lof the information in this document is outdated.

Using Git with Unity

Git logo

Git is a popular free and open source distributed version control system.

I am new to Unity, but as a long time git user, I wanted to use git for my

@maxmcguire
maxmcguire / ReorderComponents.cs
Last active July 10, 2023 11:41
A small utility to reorder components with drag and drop in Unity
/**
The MIT License (MIT)
Copyright (c) 2015, Max McGuire
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
@jhorikawa
jhorikawa / VertexColor.shader
Created January 15, 2018 18:39
Unity Shader to visualize vertex color.
Shader "Custom/VertexColor" {
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert vertex:vert
#pragma target 3.0
struct Input {
@gekidoslair
gekidoslair / ResetParentTransform.cs
Created November 10, 2019 01:07
Quick utility to reset a parent GameObject position to 0,0,0 without screwing up the child positions
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace MWU.Shared.Utilities
{
public static class ResetParentTransform
{
[MenuItem("Tools/Edit/Reset Parent Transform %_r")]
public static void DistributeObjectsEvenly()
@gekidoslair
gekidoslair / CreateEmptyAtRoot.cs
Created November 10, 2019 17:13
Adds 'Create Empty at Root' shortcut for the GameObject / right-click context menu to create an empty gameobject at 0,0,0
using UnityEditor;
using UnityEngine;
namespace MWU.Shared.Utilities
{
public class CreateEmptyAtRoot : MonoBehaviour
{
[MenuItem("GameObject/Create Empty at Root", false, 0)]
public static void Create()
@aleannox
aleannox / FixClothBounds.cs
Created April 17, 2020 19:27
[Unity] Fixes wrong Skinned Mesh Renderer bounds occurring with Cloth component
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
// Fixes wrong Skinned Mesh Renderer bounds occurring with Cloth component.
// Attach this to camera.
//
// Idea: Before camera determines culling, we override the automatically computed
// bounds with our own for all game objects with a Skinned Mesh Render in the present scene.
// In this example, we use the bounds of the undeformed mesh