Skip to content

Instantly share code, notes, and snippets.

View gakkossphynx's full-sized avatar
💯
Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work

SPHYNX gakkossphynx

💯
Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work-Work
  • TR
View GitHub Profile
using UnityEngine;
using System.Collections;
using System.Security.Cryptography;
using System.Text;
public class EncryptedPlayerPrefs {
// Encrypted PlayerPrefs
// Written by Sven Magnus
// MD5 code by Matthew Wegner (from [url]http://www.unifycommunity.com/wiki/index.php?title=MD5[/url])
@mikezila
mikezila / TGALoader.cs
Created April 12, 2014 21:13
TGA Loader for Unity3D
// This was made by aaro4130 on the Unity forums. Thanks boss!
// It's been optimized and slimmed down for the purpose of loading Quake 3 TGA textures from memory streams.
using System;
using System.IO;
using UnityEngine;
public static class TGALoader
{
@MadLittleMods
MadLittleMods / CharacterDriver.cs
Last active March 15, 2022 09:24
Unity Character Driver/Controller for Movement, Jumping, and Gravity
using UnityEngine;
using System.Collections;
[RequireComponent (typeof(CharacterController))]
public class CharacterDriver : MonoBehaviour {
public class CharacterState
{
public Vector3 position = new Vector3();
@soyliquid
soyliquid / SmoothSyncObject.cs
Last active May 16, 2023 08:25
[Unity][Photon]GameObjectの位置と回転、Animatorを同期する
using UnityEngine;
using Hashtable = ExitGames.Client.Photon.Hashtable;
public class SmoothSyncObject : MonoBehaviour
{
public PhotonView OwnerView;
public GameObject[] SyncTargets;
public Animator SycnAnimator;
// public int RootTargetId = 0; // target which affects position.
private bool isDeltaTimeBasedSmoothing = false;
@shaunsales
shaunsales / Linear_Remap.cs
Last active June 6, 2025 19:28
Linear Remap - map the value of one range to another range
// Remap the value of a range to the equivalent in another range
// Y = (X-A)/(B-A) * (D-C) + C
// Use floats because of the percentage significand
float rangeOneStart = 500, rangeOneEnd = 1000;
float rangeTwoStart = 0.5f, rangeTwoEnd = 2.0f;
// Choose an arbitrary number within range one
float numberInRangeOne = 750;
@Fonserbc
Fonserbc / Easing.cs
Last active October 30, 2025 21:21
Compact and simple easing functions for Unity
using UnityEngine;
/*
* Most functions taken from Tween.js - Licensed under the MIT license
* at https://github.com/sole/tween.js
* Quadratic.Bezier by @fonserbc - Licensed under WTFPL license
*/
public delegate float EasingFunction(float k);
public class Easing
@fadookie
fadookie / CameraAnchor.cs
Last active September 3, 2025 02:11
Screen-relative anchoring component for Unity3D. Find more Unity code at http://www.eliotlash.com/2015/01/unity3d-components-and-code-snippets/
/***
* This script will anchor a GameObject to a relative screen position.
* This script is intended to be used with ViewportHandler.cs by Marcel Căşvan, available here: http://gamedev.stackexchange.com/a/89973/50623
* It is also copied in this gist below.
*
* Note: For performance reasons it's currently assumed that the game resolution will not change after the game starts.
* You could not make this assumption by periodically calling UpdateAnchor() in the Update() function or a coroutine, but is left as an exercise to the reader.
*/
/* The MIT License (MIT)
@timofei7
timofei7 / Singleton.cs
Last active October 1, 2022 10:06
unity3d c# singleton class with automatic prefab loading
using UnityEngine;
using System.Collections;
using System;
/// <summary>
/// Prefab attribute. Use this on child classes
/// to define if they have a prefab associated or not
/// By default will attempt to load a prefab
/// that has the same name as the class,
/// otherwise [Prefab("path/to/prefab")]
@cjddmut
cjddmut / EasingFunctions.cs
Last active November 29, 2025 10:59
Easing Functions for Unity3D
/*
* Created by C.J. Kimberlin
*
* The MIT License (MIT)
*
* Copyright (c) 2019
*
* 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
using UnityEngine;
using System.Collections;
public class Water : MonoBehaviour {
public struct Flux {
public float l;
public float r;
public float t;
public float b;