Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created June 19, 2017 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/8c294f2ddaed504f3e3224a225c32122 to your computer and use it in GitHub Desktop.
Save tsubaki/8c294f2ddaed504f3e3224a225c32122 to your computer and use it in GitHub Desktop.
Resourcesからの取得
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(UnityEngine.UI.Text))]
public class ClickCountUpdater : MonoBehaviour {
ClickCount clickCount = null;
static System.Text.StringBuilder builder = new System.Text.StringBuilder(2);
UnityEngine.UI.Text label;
void Awake()
{
label = GetComponent<UnityEngine.UI.Text> ();
// ScriptableObjectの取得
clickCount = Resources.Load<ClickCount> ("ClickCountData");
}
void Update ()
{
builder.Length = 0;
builder.AppendFormat ("{0:D2}", clickCount.count);
label.text = builder.ToString ();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment