Skip to content

Instantly share code, notes, and snippets.

@fum1h1ro
Created March 19, 2014 09:03
Show Gist options
  • Save fum1h1ro/9638036 to your computer and use it in GitHub Desktop.
Save fum1h1ro/9638036 to your computer and use it in GitHub Desktop.
ビルド番号表示
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