Skip to content

Instantly share code, notes, and snippets.

@yasuakiohama
Created June 14, 2015 00:16
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 yasuakiohama/a4fd3fc1fae0cd37502a to your computer and use it in GitHub Desktop.
Save yasuakiohama/a4fd3fc1fae0cd37502a to your computer and use it in GitHub Desktop.
NameCreatorSample.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class NameCreatorSample : MonoBehaviour
{
void Start ()
{
AudioManager.Instance.PlayBGM (BGMName.thunderstorm1);
SpriteLoad ();
SpriteSampleCreate ();
InvokeRepeating ("Test", 1, 1);
}
Dictionary<string, Sprite> _sprite = new Dictionary<string, Sprite> ();
void SpriteLoad()
{
object[] _spriteList = Resources.LoadAll<Sprite> ("Sprites");
_sprite = new Dictionary<string, Sprite> ();
foreach (Sprite sprite in _spriteList) {
Debug.Log (sprite.name);
_sprite [sprite.name] = sprite;
}
}
void SpriteSampleCreate()
{
GameObject test = new GameObject ();
test.AddComponent<SpriteRenderer> ();
test.GetComponent<SpriteRenderer> ().sprite = _sprite [SpriteName.face];
}
void Test()
{
AudioManager.Instance.PlaySE (SEName.A1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment