Skip to content

Instantly share code, notes, and snippets.

View PixelEnvision's full-sized avatar

Erdener PixelEnvision

View GitHub Profile
@PixelEnvision
PixelEnvision / CinemachineCameraSizeAdjuster.cs
Last active February 8, 2023 13:40
Cinemachine Camera Size Adjuster Extension (Aspect Ratio Based Width Scaling)
using Cinemachine;
using UnityEngine;
namespace Cinemachine
{
[AddComponentMenu("")] // Hide in menu
[SaveDuringPlay]
[ExecuteAlways]
[DisallowMultipleComponent]
public class CinemachineCameraSizeAdjuster : CinemachineExtension
@PixelEnvision
PixelEnvision / ReplaceWithPrefab.cs
Created February 7, 2023 11:58
Tool to replace multiple game objects or prefabs with a different prefab, drop in "Editor" folder.
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
public class ReplaceWithPrefab : EditorWindow
{
[SerializeField] private GameObject prefab;
[MenuItem("Tools/Replace With Prefab")]
static void CreateReplaceWithPrefab()
@PixelEnvision
PixelEnvision / CinemachineGroundChecker.cs
Created February 7, 2023 12:04
A Cinemachine Extension to keep the camera above ground.
using UnityEngine;
using Cinemachine;
[AddComponentMenu("")] // Hide in menu
[SaveDuringPlay]
#if UNITY_2018_3_OR_NEWER
[ExecuteAlways]
#else
[ExecuteInEditMode]
#endif