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
/** | |
* ============================================================================ | |
* MIT License | |
* | |
* Copyright (c) 2017 Eric Phillips | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a | |
* copy of this software and associated documentation files (the "Software"), | |
* to deal in the Software without restriction, including without limitation | |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
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 UnityEngine.UI; | |
// For a discussion of the code, see: https://www.hallgrimgames.com/blog/2018/11/25/custom-unity-ui-meshes | |
public class MyUiElement : MaskableGraphic | |
{ | |
public float GridCellSize = 40f; | |
[SerializeField] |
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; | |
public class CursorManager : MonoBehaviour { | |
#region Static | |
#region Singleton | |
/* Class is a MonoBehaviour to recieve OnApplicationFocus(bool) message | |
* If no instance already present, one will be created BEFORE scene load | |
* CursorManager placed in scene will override auto-created instance | |
* Any created instance will call DontDestroyOnLoad on itself, but still gets overridden by scene |
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; | |
public class QuadTreeTest : MonoBehaviour { | |
public class TestObject : IQuadTreeObject{ | |
private Vector3 m_vPosition; | |
public TestObject(Vector3 position){ | |
m_vPosition = position; | |
} | |
public Vector2 GetPosition(){ |
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 System.Linq; | |
using System.Reflection; | |
using UnityEditor; | |
using UnityEngine; | |
/// <summary> | |
/// A base class for creating editors that decorate Unity's built-in editor types. | |
/// </summary> | |
public abstract class DecoratorEditor : Editor |
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> | |
/// Put this component on game objects that you wish to disable on specific platforms | |
/// </summary> | |
public class DisableOnPlatforms : MonoBehaviour { | |
[SerializeField] | |
[Tooltip("Selected Platforms to disable game object")] | |
private RuntimePlatform[] _platforms; | |
private void OnEnable() { | |
if (_platforms.Contains(Application.platform)) { |
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; | |
using UnityEngine; | |
public static class ApplicationState | |
{ | |
/// <summary> | |
/// Is editor either currently in play mode, or about to switch to it? | |
/// </summary> | |
public static bool isPlayingOrWillChangePlaymode { get { return Application.isEditor ? InternalEditorState.isPlayingOrWillChangePlaymode : true; } } | |
/// <summary> |
EDIT: this is an old post and a lof the information in this document is outdated.
Git is a popular free and open source distributed version control system.
I am new to Unity, but as a long time git user, I wanted to use git for my
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; | |
using System.IO; | |
using UnityEngine; | |
public class AsyncBundleLoader : MonoBehaviour | |
{ | |
// Used for visual debugging as to not generate unnecessary allocations | |
public GameObject worldLight; | |
// Private fields to keep track of loaded objects |
OlderNewer