Skip to content

Instantly share code, notes, and snippets.

View dsjs-web's full-sized avatar
💭
It's now or never

DSJS dsjs-web

💭
It's now or never
View GitHub Profile
using UnityEngine;
public class GunSprint : MonoBehaviour {
[SerializeField] private Bullet _bulletPrefab;
[SerializeField] private Transform _spawnPoint;
[SerializeField] private ParticleSystem _smokeSystem;
[SerializeField] private LayerMask _targetLayer;
[SerializeField] private float _bulletSpeed = 12;
[SerializeField] private float _torque = 120;
@bison--
bison-- / FlyCamera.cs
Last active May 16, 2024 15:37 — forked from Mahelita/FlyCamera.cs
New Script FlyCamera add to any camera obj: instant unity editor style wasd right click debug cam, NEW UNITY INPUT SYSTEM
using UnityEngine;
using System.Collections;
using UnityEngine.InputSystem;
public class FlyCamera : MonoBehaviour
{
/*
Writen by Windexglow 11-13-10. Use it, edit it, steal it I don't care.
Converted to C# 27-02-13 - no credit wanted.
@kurtdekker
kurtdekker / CheesyGrid.cs
Last active February 24, 2025 14:42
A super-cheesy 2D map / grid editor for Unity3D
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
// @kurtdekker - ultra Cheesy grid with in-built editor for Unity3D
//
// To use:
// make an empty game object
// drag this script on it
@nukadelic
nukadelic / EditorFontSize.cs
Last active August 9, 2025 05:44
Unity Editor Font Size Changer -- EditorStyles
#if UNITY_EDITOR
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Reflection;
public class EditorFontSize : EditorWindow
{
// enable resize on launch to set a default font size , using this option will disable the ability to have the window accassible
@Glavak
Glavak / CameraConstantWidth.cs
Last active March 15, 2025 01:34
Скрипт для поддержания постоянной ширины камеры в Unity, для туториала https://youtu.be/0cmxFjP375Y
using UnityEngine;
/// <summary>
/// Keeps constant camera width instead of height, works for both Orthographic & Perspective cameras
/// Made for tutorial https://youtu.be/0cmxFjP375Y
/// </summary>
public class CameraConstantWidth : MonoBehaviour
{
public Vector2 DefaultResolution = new Vector2(720, 1280);
[Range(0f, 1f)] public float WidthOrHeight = 0;
@ditzel
ditzel / MeshDestroy.cs
Created August 19, 2019 19:02
MeshDestroy => Put it on a game object with a mesh filter and renderer. Make sure to have read/write enabled on fbx import
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MeshDestroy : MonoBehaviour
{
private bool edgeSet = false;
private Vector3 edgeVertex = Vector3.zero;
private Vector2 edgeUV = Vector2.zero;
@DanMillerDev
DanMillerDev / MobileOcclusion.shader
Created July 30, 2019 05:52
Occlusion shader for Unity. Can be used for mobile AR Occlusion
Shader "Custom/MobileOcclusion"
{
SubShader {
Pass {
// Render the Occlusion shader before all
// opaque geometry to prime the depth buffer.
Tags { "Queue"="Geometry" }
ZWrite On
ZTest LEqual
@st4rdog
st4rdog / TreeReplacerS.cs
Created March 14, 2019 06:38
Replaces trees on a terrain with prefab.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
// Replaces Unity terrain trees with prefab GameObject.
// http://answers.unity3d.com/questions/723266/converting-all-terrain-trees-to-gameobjects.html
[ExecuteInEditMode]
public class TreeReplacerS : EditorWindow {
@shaggun
shaggun / BendMesh.shader
Last active October 24, 2023 03:33
Bending a mesh with a shader in Unity
Shader "BendMesh"
{
Properties
{
_Texture("Texture", 2D) = "white" {}
_Color("Color", Color) = (0,0,0,0)
_Amplitude("Amplitude", Float) = 0
_Frequency("Frequency", Float) = 0
_OffsetSin("OffsetSin", Float) = 0
@SeanMcTex
SeanMcTex / PinToSafeArea.cs
Last active August 9, 2024 07:11
Restrict Unity UI to an iPhone X or other Mobile Device's Safe Area
using UnityEngine;
/// <summary>
/// Resizes a UI element with a RectTransform to respect the safe areas of the current device.
/// This is particularly useful on an iPhone X, where we have to avoid the notch and the screen
/// corners.
///
/// The easiest way to use it is to create a root Canvas object, attach this script to a game object called "SafeAreaContainer"
/// that is the child of the root canvas, and then layout the UI elements within the SafeAreaContainer, which
/// will adjust size appropriately for the current device./// </summary>