|
journal
all | Rob is 20,356 days old today. |
Aug 2015 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Oct 2015 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
2014
jan feb mar apr
may jun jul aug
sep oct nov dec
2016
jan feb mar apr
may jun jul aug
sep oct nov dec
|< << more >> >| |
Entries this day: lotsa-little-scripts lotsa little scripts 15:44 Thursday 03 September 2015 JSTI just watched a couple Unity tutorials and they both showed people creating multiple little scripts to do multiple little things using UnityEngine;
using System.Collections;
public class LoadOnClick : MonoBehaviour {
public GameObject loadingImage;
public void LoadScene(int level)
{
loadingImage.SetActive(true);
Application.LoadLevel(level);
}
}
using UnityEngine;
using System.Collections;
public class HighlightScript : MonoBehaviour {
void OnMouseEnter()
{
iTween.ColorTo(gameObject, Color.red, 0.2f);
}
void OnMouseExit()
{
iTween.ColorTo(gameObject, Color.white, 0.2f);
}
}
using UnityEngine;
using System.Collections;
public class DontDestroy : MonoBehaviour {
// Use this for initialization
void Awake () {
DontDestroyOnLoad(gameObject);
}
}
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ClickToLoadAsync : MonoBehaviour {
public Slider loadingBar;
public GameObject loadingImage;
private AsyncOperation async;
public void ClickAsync(int level)
{
loadingImage.SetActive(true);
StartCoroutine(LoadLevelWithBar(level));
}
IEnumerator LoadLevelWithBar (int level)
{
async = Application.LoadLevelAsync(level);
while (!async.isDone)
{
loadingBar.value = async.progress;
yield return null;
}
}
}
prev day next day |