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; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System; | |
/* | |
Simple EventManager class to implement one-to-many event passing. Features: | |
* Simple enum and payload events. | |
* Delayed event sending (send later in the frame in one place). | |
* Detects adding duplicates/removing non-existent listeners in Unity editor mode. |
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
// Create Dropdown button | |
if (EditorGUI.DropdownButton(position, GUIContent.none, FocusType.Passive)) | |
{ | |
var genericMenu = new GenericMenu(); | |
// List<string> options | |
foreach (var option in options) | |
{ | |
bool selected = option == property.stringValue; | |
genericMenu.AddItem(new GUIContent(options), selected, () => |
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; | |
// Render the screen in lower resolution | |
[ExecuteInEditMode] | |
[RequireComponent(typeof(Camera))] | |
public class ResoScaler : MonoBehaviour | |
{ | |
[Range(1, 8)] | |
public float scale = 1; |
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
// A simple Unity example script that makes a UI component track position of world space object rendered with | |
// specific world space camera. Canvas needs to be in Screen Space Camera mode. | |
[ExecuteInEditMode] | |
public class UIFollow : MonoBehaviour | |
{ | |
[Tooltip("World space object to follow")] | |
public GameObject target; | |
[Tooltip("World space camera that renders the target")] | |
public Camera worldCamera; | |
[Tooltip("Canvas set in Screen Space Camera mode")] |
OlderNewer