Skip to content

Instantly share code, notes, and snippets.

@HolyFot
HolyFot / ToggleC.cs
Last active Oct 5, 2021
Better Toggles for Unity UI (Down image, custom fade time, no deselect bug)
View ToggleC.cs
//Made by: HolyFot
//License: CC0 - https://creativecommons.org/share-your-work/public-domain/cc0/
//Note: ToggleC scripts must be childs of ToggleGroupC
//Note: "TargetGraphic" is a separate child image.
//Version 1.1 (Fix warnings & selection bug)
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using System.Collections;
@HolyFot
HolyFot / SliderPercent.cs
Created Jul 15, 2020
Slider Percent UI C# Unity
View SliderPercent.cs
//Made by: HolyFot
//License: CC0 - https://creativecommons.org/share-your-work/public-domain/cc0/
//Notes: Handles negative to positive ranges too.
using System;
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(Slider))]
public class SliderPercent : MonoBehaviour
{
@HolyFot
HolyFot / SimpleIni.cs
Created Jul 15, 2020
Simple INI Writer/Reader C# Unity
View SimpleIni.cs
// Made by: HolyFot
// Very Simple INI Parser/Writer.
// Ignores Comments and is Case Sensitive.
using UnityEngine;
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
public class SimpleIni
@HolyFot
HolyFot / FPSNetStats.cs
Last active Aug 28, 2020
FPS & KBs In and Out for Forge/Unity C#
View FPSNetStats.cs
//Displays: actual FPS, KBs In/Out for Forge, System Info
//Author: HolyFot
//License: CC0
using UnityEngine;
using System;
using System.Collections;
using BeardedManStudios.Forge.Networking;
using BeardedManStudios.Forge.Networking.Unity;
public class FPSNetStats : MonoBehaviour
@HolyFot
HolyFot / Example.cs
Created Jul 15, 2020
Map/Scene Truly Loaded Detector C# Unity
View Example.cs
//EXAMPLE USAGE:
void OnEnable()
{
if (MapLoadDetector.Instance != null)
MapLoadDetector.Instance.onMap1LoadedCall += OnMapLoaded;
}
void OnDisable()
{
if (MapLoadDetector.Instance != null)
@HolyFot
HolyFot / CharacterLOD.cs
Created Jul 17, 2020
Non-invasive Character/NPC LOD Script C# Unity
View CharacterLOD.cs
//Made by: HolyFot
//License: CC0 - https://creativecommons.org/share-your-work/public-domain/cc0/
//For SkinneMeshRenderers (Characters/NPCs/Etc). This script was made to just swap the mesh/materials for LODs, since Unity's LOD Group to change the entire object which isn't ideal for weapons/armor/objects.
//This is a roughdraft, but works.
using UnityEngine;
using System;
using System.Collections.Generic;
//[ExecuteInEditMode]
public class CharacterLOD : MonoBehaviour
@HolyFot
HolyFot / Example.cs
Created Jul 17, 2020
Re-usable YesNo Window C# Unity
View Example.cs
//Example
public YesNoWindow yesNoWindow;
public void ExitGame()
{
if (yesNoWindow != null)
{
yesNoWindow.onYesClickCall += ExitGame2;
yesNoWindow.ShowYesNo("Are you sure you wish to quit the game?");
}
View Example.cs
//Example
public void AddFriend()
{
//Show Input Window
if (inputWindow != null)
{
inputWindow.onOkClickCall += AddFriend2;
inputWindow.ShowInputWindow("Username to add as friend:");
}
}
@HolyFot
HolyFot / SimpleLOD.cs
Created Jul 17, 2020
SimpleLOD C# Unity
View SimpleLOD.cs
//Made by: HolyFot
//License: CC0 - https://creativecommons.org/share-your-work/public-domain/cc0/
//For MeshRenderers (Basic Objects). Quickly swaps the mesh/materials for LODs, replacement for LOD Group.
//This is a roughdraft, but works.
using UnityEngine;
using System;
using System.Collections.Generic;
//[ExecuteInEditMode]
public class SimpleLOD : MonoBehaviour
@HolyFot
HolyFot / CubeBuilding.cs
Last active Aug 23, 2020
Old Voxel Minecraft Cube System C# Unity
View CubeBuilding.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using Ist;
using BeardedManStudios.Network;
public class CubeBuilding : MonoBehaviour
{
public enum DataTransferMode