Skip to content

Instantly share code, notes, and snippets.

View RGSMS's full-sized avatar

Rômulo Gomes de Souza Marques dos Santos RGSMS

View GitHub Profile
@kkukshtel
kkukshtel / DebugText.cs
Last active September 12, 2019 20:32
Add text into your Unity Game/Scene view using only a script. Basically Debug.Log for runtime text.
//by kyle kukshtel
//sample usage of DebugText.cs
using UnityEngine;
using System.Collections.Generic;
public static class DebugText
{
static float defaultXScale = .3f;
static float defaultYScale = .3f;
@rus89
rus89 / .gitignore
Last active September 2, 2018 18:42
.gitignore sample for Unity, Monodevelop, VisualStudio, VisualStudioCode on OSX, Windows and Linux OS, thanks to: http://midva.games/, https://play.google.com/store/apps/developer?id=Midva.Games
# Created by https://www.gitignore.io/api/osx,linux,unity,csharp,windows,monodevelop,visualstudio,visualstudiocode
### Csharp ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
@yagero
yagero / ShaderRenderState.cs
Last active February 13, 2022 15:20
Helpful extension methods to customize Unity's shaders render state from script
public static class ShaderRenderState
{
public enum ZWrite //couldn't find any similar enum in UnityEngine.Rendering
{
Off = 0,
On = 1
}
public static void SetStencilRef(this Material mat, int value) { mat.SetInt("_StencilRef", value); }
public static void SetStencilComp(this Material mat, UnityEngine.Rendering.CompareFunction value) { mat.SetInt("_StencilComp", (int)value); }
@darkon76
darkon76 / AnimatedText
Last active February 19, 2019 09:43
UI Canvas. Animated conversation text.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(Text))]
public class AnimatedText: BaseMeshEffect
{
[SerializeField] private float _waitBetweenLetters = .1f;
private CanvasRenderer _canvasRendered;
@yagero
yagero / ButtonSmartNav.cs
Last active March 18, 2024 06:39
Unity UI ButtonSmartNav
using UnityEngine.UI;
// Use this class instead of Unity's default Button
// to automatically skip disabled and inactive Buttons
// if you define your navigation as explicit
public class ButtonSmartNav : Button
{
bool CanReachSelectable(Selectable select)
{
return !select || (select.interactable && select.gameObject.activeInHierarchy);
@QubitsDev
QubitsDev / ScrollRectAutoScroll.cs
Last active July 22, 2023 21:43
Unity3d ScrollRect Auto-Scroll, Dropdown Use: Places this component in the Template of Dropdown (with the ScrollRect component)
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
[RequireComponent(typeof(ScrollRect))]
[AddComponentMenu("UI/ScrollRect Auto-Scroll")]
public class ScrollRectAutoScroll : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
public float scrollSpeed = 10f;
private bool mouseOver = false;
@KeaneGames
KeaneGames / LockedInspectorPopup.cs
Created August 18, 2017 18:37
Adds a "Open locked inspector" command to the right click menu of the Hierarchy & Project View. Or just select an object and hit ctrl + i. Place the script in a folder named "Editor" somewhere in your unity project
/* Copyright (c) 2017 Jacob Keane <http://jacobkeane.co.uk>. All rights reserved.
This work is licensed under the terms of the MIT license. For a copy, see <https://opensource.org/licenses/MIT>. */
#if UNITY_EDITOR
using UnityEditor;
/// <summary>
/// A simple script to allow you to open a locked inspector for the currently selected object
/// Right click on a GameObject in either the Hierarchy or Project view and select "Open Locked Inspector"
/// Or press CTRL+I.
@ByronMayne
ByronMayne / AnimatedComponent.cs
Created May 29, 2017 11:17
The source code behind my Unity tip.
using UnityEngine;
using System.Collections;
// This is not need but I just wanted to make the point clear.
public class AnimatedComponent : MonoBehaviour
{
}
@SaffronCR
SaffronCR / FSMSystem.cs
Last active October 30, 2023 02:04
[C#, Unity] Lightweight State Machine based on Stateless and this great example: http://wiki.unity3d.com/index.php?title=Finite_State_Machine
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Place the labels for the Triggers in this enum.
/// Don't change the first label, NullTrigger as FSMSystem class uses it.
/// </summary>
public enum Trigger
{
NullTrigger = 0, // Use this trigger to represent a non-existing trigger in your system.
@derwodaso
derwodaso / ScriptingDefineSymbolToggler.cs
Created March 14, 2017 10:34
Disable / Enable ScriptingDefineSymbolds from menu
/* To avoid performance issues caused by string constructions when logging stuff
* to the console, simply surround the code with the the following:
*
* #if DEBUG_LOGGING
* Debug.Log("my" + numer.ToString("0.00") " super" + " expensive " + " string building code");
* #endif
*
* When creating a non-debug build or testing the game for performance, simply disable
* the debug messages from the Unity menu (menu name can be simply changed below).
*/