Skip to content

Instantly share code, notes, and snippets.

@bibinba
Created June 16, 2019 13:41
Show Gist options
  • Save bibinba/bac82b1984ae08a51d6ea504ede1f023 to your computer and use it in GitHub Desktop.
Save bibinba/bac82b1984ae08a51d6ea504ede1f023 to your computer and use it in GitHub Desktop.
FlyingFontで入力した文字を出す
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class fontmaker : MonoBehaviour
{
public InputField inputfield;
public Material material;
public Material edgeMaterial;
public GameObject parentObj;
// Start is called before the first frame update
void Start()
{
}
public void onEndText()
{
Vector3 random = new Vector3(Random.Range(-10.0f, 4.0f), 5, Random.Range(-1.5f, 6.0f));
float size = Random.Range(1.2f, 4.6f);
GameObject obj = FlyingText.GetObjects(inputfield.text,material,edgeMaterial,size,0.5f,5,random, Quaternion.identity);
obj.transform.parent = parentObj.transform;
InitInputField();
}
public void OnDestroyfont()
{
foreach (Transform child in parentObj.transform)
{
// 一つずつ破棄する
Destroy(child.gameObject);
}
}
void InitInputField()
{
// 値をリセット
inputfield.text = "";
// フォーカス
inputfield.ActivateInputField();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment