This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyBehavior : MonoBehaviour { | |
// This will store the string value | |
[StringInList("Cat", "Dog")] public string Animal; | |
// This will store the index of the array value | |
[StringInList("John", "Jack", "Jim")] public int PersonID; | |
// Showing a list of loaded scenes | |
[StringInList(typeof(PropertyDrawersHelper), "AllSceneNames")] public string SceneName; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
namespace FMPUtils.Projectile | |
{ | |
/// <summary> | |
/// Add this component to objects that should receive projectile impacts | |
/// </summary> | |
[RequireComponent(typeof(Collider))] | |
public class ProjectileImpactReceiver : MonoBehaviour | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace FMPUtils | |
{ | |
/// <summary> | |
/// Extension of the messenger from Wokarol (found at https://github.com/Wokarol/Messenger) using integer tags by utilizing | |
/// bitmasks | |
/// Tags can be any number between 0 and 63, the broadcaster of an event can specify something akin to a layermask | |
/// and all subscribers that have a tag number that is inside this mask will receive the event |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
[RequireComponent(typeof(MeshRenderer))] | |
[RequireComponent(typeof(MeshFilter))] | |
public class CirceMeshBuilder : MonoBehaviour | |
{ | |
[SerializeField] private Material materialTemplate; | |
[SerializeField] private bool createMaterialCopy; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
using UnityEngine.SceneManagement; | |
using System.Linq; | |
namespace FMPUtils.Editor | |
{ | |
public class ReplaceSceneObjectsWithPrefabWindow : EditorWindow | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace FMPUtils | |
{ | |
public static class SingletonProvider | |
{ | |
private static readonly Dictionary<Type, Func<object>> instanceAccessors = new Dictionary<Type, Func<object>>(); | |
public static void Clear() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using System.Text; | |
using UnityEngine; | |
using UnityEditor; | |
using System.IO; | |
using System.Linq; | |
namespace FMPUtils.Editor | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An additional implementation for piecewise interpolation described in this article: | |
// https://www.alanzucconi.com/2021/01/24/linear-interpolation/ | |
// It has the limitation that it requires the delta difference between 2 adjacent values of the input array to always be constant. | |
// For example: inputs[2] - inputs[1] = 0.2f; inputs inputs[3] - inputs[2] = 0.2f; etc. | |
public static float PiecewiseLerp (float[] inputs, float[] results, float desiredInput) | |
{ | |
int n = inputs.Length; | |
float inputMin = inputs[0]; | |
float inputMax = inputs[n - 1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
namespace FMPUtils.Randomness | |
{ | |
[System.Serializable] | |
public class PerlinNoiseMap | |
{ | |
[SerializeField] private Vector2Int originOffset; | |
[SerializeField] private Vector2Int mapSize; | |
[SerializeField] private float cellSampleSizeMultiplier; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
namespace FMPUtils.Randomness | |
{ | |
public class WeightedRandomPrefabSupply : MonoBehaviour | |
{ | |
[System.Serializable] | |
public class WeightedGameObjectElement : WeightedElement<GameObject> | |
{ | |
} |