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.Collections.Generic; | |
using UnityEngine; | |
using Unity.Burst; | |
using Unity.Collections; | |
using Unity.Entities; | |
using Unity.Jobs; | |
using Unity.Mathematics; | |
using Unity.Transforms; |
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.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
public class GUIStylesExample : EditorWindow { | |
string textFieldString = "This is a textbox that looks like a bold Label."; | |
[MenuItem("My Tools/GUI Styles Example")] |
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> | |
/// This script demonstrates how to convert a bool array to a string of bits and convert a string of bits to a bool array. | |
/// Usage: | |
/// - Attach this script to an empty gameobject. From the Inspector set the values of the items in the bool array. | |
/// - Enter Play Mode. | |
/// - Hit 'a' key, the values of the bool array will be converted to a bit string. | |
/// - Hit 's' key, bit string will be converted into a bool array. | |
/// </summary> | |
using UnityEngine; |
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
// Attach this script to a gameobject in the scene. objectDetails01 is serialized into JSON and stored | |
// in a string. Then the JSON string is deserialized and cast to ObjectDetails type, and stored into | |
// objectDetails02. The data of objectDetails02 can be seen in the Inspector. | |
using UnityEngine; | |
public class JsonExample02 : MonoBehaviour { | |
public ObjectDetails objectDetails01; | |
public ObjectDetails objectDetails02; |
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
// Attach this script to a gameobject in the scene. myChar01 is serialized into JSON and stored | |
// in a string. Then the JSON is deserialized and cast to Character type, and stored into myChar02. | |
// The data of myChar02 can be seen in the Inspector. | |
using UnityEngine; | |
public class JsonExample01 : MonoBehaviour { | |
public Character myChar01; | |
public Character myChar02; |
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; | |
namespace GOTO.Logic.Comparers | |
{ | |
[Serializable] | |
[ComparerCategory("Comparer")] | |
public class KeyEventComparer : Comparer | |
{ | |
public enum KeyEventType { KeyDown, KeyUp, KeyPress }; |
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> | |
/// Attach this script to any gameobject in the scene, enter Play Mode, then hit Space on your keyboard to capture a screenshot. | |
/// Exit Play Mode, refresh the Project panel, and the scenecap image should be in the Assets folder. | |
/// </summary> | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class ScreencapScript : 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
/// <summary> | |
/// Instructions | |
/// - Create a Timeline asset. Add 3 tracks to it. | |
/// - Create empty GameObject in scene. Attach this script to the GameObject. Then attach a PlayableDirector component to it. | |
/// Drag and drop the Timeline asset you created into the Playable field of the PlayableDirector. | |
/// - Hit Play. The 1, 2 and 3 keys on your keyboard mute the first, second and third tracks respectively. | |
/// </summary> | |
using System.Collections; | |
using System.Collections.Generic; |
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> | |
/// - Make sure you have a Grid GameObject (any GameObject with a Grid component attached to it) in the scene. | |
/// - Attach this script to the GameObject you wanna snap to the Grid. Then drag and drop the Grid | |
/// GameObject into the AttachedGrid field to create a reference to the Grid component attached to it. | |
/// - Enter Play Mode, and then every time you hit the Space key, this GameObject will move 1 unit | |
/// down along the Y axis, while remaining snapped to the Grid. | |
/// </summary> | |
using System.Collections; | |
using System.Collections.Generic; |
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
// Just something fun I came up with when learning Trigonometry. | |
// Attach this script to an empty gameobject and enter Play Mode. A circle of spheres will be created. All the spheres will be | |
// children of the gameobject that this script is attached to. When you hit the Spacebar key, the position of each sphere will | |
// start updating and from that point on, every frame the positions will be updated to form patterns. | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class CircleGenScript01 : MonoBehaviour { |