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 { |
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> | |
/// ----------------------------- | |
/// Transform Changes tool | |
/// ----------------------------- | |
/// This is a simple tool that allows you to store any changes made to the Position, Rotation and Scale of all Gameobjects in the scene | |
/// during PlayMode, and apply those changes to all the Gameobjects after exiting PlayMode. | |
/// Instructions: | |
/// -Place this script in the Editor folder in your project. Then the 'MyTools' menu should appear in your MenuBar with the | |
/// Store and Apply options. | |
/// -Enter PlayMode. Make changes to the Postion, Rotation and Scale of gameobjects in the scene. Click 'MyTools/Store Transform PlayMode Changes'. |
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> | |
/// ----------------------------- | |
/// Gameobject selector window | |
/// ----------------------------- | |
/// Make sure to place this script in the Editor folder. To open the window click 'MyTools/GameobjectSelector'. | |
/// This window lets you assign a gameobject to the ObjectToSelect field. Once a gameobject is assigned, if the gameobject | |
/// has any child gameobjects, four buttons will show up, giving you the following options. | |
/// 1.Select Parent gameobject | |
/// 2.Select First child gameobject | |
/// 3.Select Last child gameobject |
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
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
// 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
// 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
/// <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
/// <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
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; |
OlderNewer