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
@namespace url(http://www.w3.org/1999/xhtml); | |
@-moz-document domain("forum.unity3d.com") { | |
/* | |
Unity3D Forums Style (to make the new forums bit more easier to read..) | |
Stylish plugin for Firefox : https://addons.mozilla.org/en-US/firefox/addon/stylish/ | |
WORK-IN-PROGRESS (Feel Free To Fork/Suggest new css) | |
*/ |
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 PauseMode : MonoBehaviour | |
{ | |
void Update () | |
{ | |
if (Input.GetKeyDown ("p")) Time.timeScale = 1-Time.timeScale; | |
} | |
} |
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
// http://unitypatterns.com/scripting-with-coroutines/ | |
IEnumerator Wait(float duration) | |
{ | |
for (float timer = 0; timer < duration; timer += Time.deltaTime) | |
{ | |
yield return 0; | |
} | |
} |
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; | |
public struct Vector2i | |
{ | |
private int X; | |
private int Y; | |
private int x | |
{ | |
set { X = value; } |
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
carves.Sort(delegate(Carve a, Carve b) { return a.cumulativeDifference.CompareTo(b.cumulativeDifference); }); | |
/* | |
// example struct values | |
public struct Carve | |
{ | |
public float cumulativeDifference; | |
public List<int> x; | |
public List<int> y; |
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
// need to create new sprite, cannot assign or convert Texture2D into sprite | |
Sprite sprite = Sprite.Create (tex, new Rect(0,0,tex.width,tex.height), new Vector2 (0, 0), pixelToUnits); | |
GetComponent<SpriteRenderer>().sprite = sprite; | |
http://docs.unity3d.com/ScriptReference/Sprite.Create.html |
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
public InputField myField; | |
//.. | |
myField.Select(); | |
myField.ActivateInputField(); |
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
EventSystem eventSystem; | |
//.. | |
void Start () | |
{ | |
GameObject go = GameObject.Find("EventSystem"); | |
if (go==null) | |
{ | |
Debug.LogError("EventSystem not founded.."); | |
}else{ | |
eventSystem = go.GetComponent<UnityEngine.EventSystems.EventSystem>(); |
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
config.params["disableContextMenu"] = true; // add this line | |
var u = new UnityObject2(config); |
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 GetSliderValue : MonoBehaviour { | |
public YourScript yourScript; | |
void Awake () | |
{ |
OlderNewer