KITASENJU DESIGN BLOG

memo, html, javascript, unity

FlyingText3D 使い方

assetstore.unity.com

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FontGen : MonoBehaviour
{

    int _index = 0;
    string _texts="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";

    // Start is called before the first frame update
    void Start()
    {


        _loop();
    }

    private void _loop(){
        
        var textObject = FlyingText.GetObject (
            _texts.Substring(Mathf.FloorToInt(_texts.Length*Random.value),1), transform.position, Quaternion.identity
        );
        
        float ss = (1f + 4f*Random.value);
        textObject.transform.localScale = new Vector3(
            ss,ss,6f
        );


//if you want to add Script
        var b = textObject.AddComponent<Ball>();
        b.Init();
        b.AddForce();

        _index++;
        _index=_index%10;

        Invoke("_loop",1f);

    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

"FOOTER"