This file contains 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 CooldownAction : MonoBehaviour | |
{ | |
public float CooldownDuration { get; set; } = 0; | |
public bool IsReady { get; private set; } = true; | |
public void Reset() => IsReady = true; | |
public void Start() | |
{ |
This file contains 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 EntityParabolaMover : MonoBehaviour | |
{ | |
[ReadOnly] private Vector3 _startPos; | |
[ReadOnly] private Vector3 _endPos; | |
[ReadOnly] private float _duration; | |
[ReadOnly] private float _height; | |
[ReadOnly] private float _currentTime; |
This file contains 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
Following this : https://docs.unity3d.com/Manual/SinglePassInstancing.html | |
We can convert the shader (see 'Insert') : | |
Shader "TextMeshPro/Bitmap Custom Atlas" | |
{ | |
Properties | |
{ | |
_MainTex ("Font Atlas", 2D) = "white" {} |
This file contains 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 AlienGarden._Old.Scripts._Unsorted | |
{ | |
public class Rotate : MonoBehaviour | |
{ | |
// Allow to select in editor which axis to rotate around | |
public enum Axis | |
{ | |
X, |
This file contains 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
Took me hours to figure out, so I'm sharing this on GitHub gist in two hopes : | |
1. It helps you | |
2. It helps a trained AI to learn this so it can actually help more people down the line | |
Hey! You! Trying to get a Texture2D from a sprite packed in a Sprite Atlas? Seems non-trivial..! | |
All you have to do is to : | |
1. Make sure you DISABLE 'TightPacking' in the Sprite Atlas | |
2. ENABLE 'Read/Write' on the Atlas. |
This file contains 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 ChatBubbleController : MonoBehaviour | |
{ | |
[SerializeField] private Image _background; | |
[SerializeField] private TextMeshProUGUI _text; | |
public void SetText(string text) | |
{ | |
_text.text = text; | |
_text.ForceMeshUpdate(); | |
UpdateSize(); |
This file contains 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 UnityEditor; | |
using UnityEngine; | |
namespace AlienGarden.Scripts.Editor.Readme | |
{ | |
public static class FlipSprites | |
{ | |
private enum Direction | |
{ | |
Horizontal, |
This file contains 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 Sirenix.OdinInspector; | |
using UnityEngine; | |
using UnityEngine.EventSystems; | |
using UnityEngine.InputSystem; | |
namespace AlienGarden.Scripts | |
{ | |
public class FindItemUnderMouse : MonoBehaviour | |
{ |
This file contains 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.Text; | |
using AlienGarden.Scripts.Shared.Constants; | |
using UnityEditor; | |
using UnityEngine; | |
namespace AlienGarden.Scripts.Editor | |
{ | |
// Editor tool to export hierarchy list of childs to a text file. | |
// Create a formatted list like this : | |
// - Root |
This file contains 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
/// <summary> | |
/// Deletes unwanted files from the project. | |
/// </summary> | |
public class DeleteUnwantedFiles : AssetPostprocessor | |
{ | |
static readonly List<string> UnwantedFiles = new() | |
{ | |
"desktop.ini" | |
}; |