Created
March 19, 2014 09:03
-
-
Save fum1h1ro/9638036 to your computer and use it in GitHub Desktop.
ビルド番号表示
This file contains hidden or 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
import UnityEngine | |
import System.IO | |
class VersionDisplay (MonoBehaviour): | |
static final _filename = 'version.txt' | |
_text as string = '' | |
def Start(): | |
StartCoroutine(reader()) | |
private def reader() as IEnumerator: | |
path = Application.streamingAssetsPath + "/${_filename}" | |
if path.Contains('://'): | |
www as WWW = WWW(path) | |
yield www | |
if string.IsNullOrEmpty(www.error): | |
_text = www.text | |
else: | |
try: | |
_text = File.ReadAllText(path) | |
except e: | |
Debug.Log("NOT FOUND") | |
_text = '' | |
if guiText != null: | |
guiText.text = _text | |
else: | |
ifdef not UNITY_EDITOR: | |
Destroy(gameObject) // 自殺 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment