Skip to content

Instantly share code, notes, and snippets.

@peroon
Created May 26, 2016 05:55
Show Gist options
  • Select an option

  • Save peroon/9f962919411b7363aab24cda82be3852 to your computer and use it in GitHub Desktop.

Select an option

Save peroon/9f962919411b7363aab24cda82be3852 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
// Canvasにエフェクトをのせる
public class CanvasEffector : SingletonMonoBehaviour<CanvasEffector> {
public GameObject starEffect;
public void Star(){
// どこにおくか
Vector2 pos = References.Instance.touchInput.GetUpEventPosition();
Debug.Log ("ここにエフェクト置く");
Debug.Log (pos);
// 生成
var star = Instantiate(starEffect) as GameObject;
star.GetComponent<RectTransform> ().anchoredPosition = pos;
// 子にする
star.gameObject.transform.SetParent(References.Instance.canvas.gameObject.transform);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment