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 UnityEditor; | |
public class AutoSnap : EditorWindow | |
{ | |
private Vector3 prevPosition; | |
private bool doSnap = true; | |
private float snapValue = 1; | |
[MenuItem( "Edit/Auto Snap %_l" )] |
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
// Asset/Script/ShowOnlyAttribute.cs | |
using UnityEngine; | |
public class ShowOnlyAttribute : PropertyAttribute | |
{ | |
} |
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
// Sequence | |
IEnumerator Sequence(params IEnumerator[] sequence) | |
{ | |
for (int i = 0; i < sequence.Length; ++i) | |
{ | |
while (sequence[i].MoveNext()) | |
yield return sequence[i].Current; | |
} | |
} |
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; | |
/** | |
* Multi Resolution Scale Policy Camera. | |
* | |
* @author Robert Ryu | |
* @date 10/13/2014 | |
*/ |
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 UnityEditor; | |
using UnityEngine; | |
public class AssetPostProcessLogger : AssetPostprocessor { | |
static void OnPostprocessAllAssets( | |
string[] importedAssets, | |
string[] deletedAssets, | |
string[] movedAssets, string[] movedFromAssetPaths | |
) |
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
private IEnumerator waitThenCallback(float time, Action callback) | |
{ | |
yield return new WaitForSeconds(time); | |
callback(); | |
} | |
void Start() | |
{ | |
splashScreen.show(); |
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
label.transform.SetParent(transform,false); | |
// Canvas = Screen Space - Overlay | |
label.transform.position = RectTransformUtility.WorldToScreenPoint(Camera.main, pos); | |
// Canvas = Screen Space - Camera | |
label.transform.position = RectTransformUtility.WorldToScreenPoint(Camera.main, Camera.main.ScreenToWorldPoint(pos)); |
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 UnityEngine.UI; | |
public class LabelController : MonoBehaviour | |
{ | |
public float fadeDuration = 0.5f; | |
public float moveDuration = 0.8f; | |
private Text _text; |
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
var ray = Camera.main.ScreenPointToRay(Input.mousePosition); | |
var groundPlane = new Plane(Vector3.up,Vector3.zero); | |
float rayDistance; | |
if (groundPlane.Raycast(ray, out rayDistance)) | |
{ | |
var point = ray.GetPoint(rayDistance); | |
} |
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; | |
public class RotateToMousePosition : Monobehaviour | |
{ | |
public int RotationOffset = 90; | |
void Update() | |
{ | |
// Difference is direction vector from current position to mouse position. | |
Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position; |
OlderNewer