Created
June 16, 2019 13:41
Star
You must be signed in to star a gist
FlyingFontで入力した文字を出す
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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