Skip to content

Instantly share code, notes, and snippets.

@rodolforubens
rodolforubens / MainComponentIcon.cs
Last active June 20, 2018 11:19
Shows main component icon of a gameobject in the scene hierarchy panel, and also a toggle box to deactivate it
// Main Component Icon, Active State Toggling and "Smart Empty Object Icon Display"
using UnityEditor;
using UnityEngine;
using System;
using System.Collections.Generic;
[InitializeOnLoad]
class MainComponentIcon
{
// only show these types if showAllTypes is false
@rodolforubens
rodolforubens / PlaceOnGroundEditor.cs
Last active March 25, 2023 11:12
Unity Editor script to drop objects on the ground using collider, renderer or its pivot point as a base.
using UnityEditor;
using UnityEngine;
public static class PlaceOnGroundEditor
{
[MenuItem("Tools/Snap to ground %&D")]
public static void PlaceOnGround()
{
var transforms = new Transform[Selection.gameObjects.Length];
for(int i = 0; i < transforms.Length; i++) transforms[i] = Selection.gameObjects[i].transform;