Giter Club home page Giter Club logo

unity-systemfontrenderer's Introduction

概要

Unity iOS および Android においてシステムフォントをテクスチャにレンダリングするプラグインの実装です。

Screens

使い方

SystemFontRenderer.js を何らかのゲームオブジェクトに付加します。パラメーターとして Inspector 上に "Text", "Text Size", "Texture Width", "Texture Height" が表示されるので、これにそれぞれ値を設定します。

注意 Texture Width と Texture Height は 2 のべき乗サイズでなくてはなりません。

これで SystemFontRenderer 内にテクスチャが生成されます。これを表示するには、何らかのマテリアルにバインドする必要があります。例えば、同ゲームオブジェクトにある表示物のマテリアルにバインドするには次のようにします。

// JavaScript
GetComponent.<SystemFontRenderer>().BindMaterial(renderer.material);

// C#
GetComponent<SystemFontRenderer>().BindMaterial(renderer.material);

なお、パラメーターの Text は動的な変更に対応しています。

GetComponent.<SystemFontRenderer>().text = "10秒待ちたまえ";
yield WaitForSeconds(10.0);
GetComponent.<SystemFontRenderer>().text = "そろそろ時間だ!";

組み込み方法

iOS では Plugins ディレクトリの内容を任意のプロジェクトにインポートするだけです。

Android ではアクティビティの置き換えを行っているため、組み込みが若干面倒です。詳しくはこちらの解説を参照してください。

Editor 上でのプレビューについて

Editor 上でも結果をプレビューすることができますが、実験的な実装のため動作が怪しいです。例えばデモプログラムでは、最初は黒い文字が出てしまっていたりします。

なお、テンポラリオブジェクトを配置するためのレイヤーとして 31 番を勝手に利用しています。もし既に 31 番レイヤーを使用している場合、描画が競合する可能性があります。

既知の問題について

既知の問題がいくつか存在します。詳しくは issues を参照してください。

unity-systemfontrenderer's People

Contributors

keijiro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

unity-systemfontrenderer's Issues

Android: プラグインの組み込み手順を簡略化したい

現状の Activity を置き換える方式では、組み込み手順が面倒だし、他に Activity を置き換えるプラグインを使用していた場合に共存が難しくなる。

どうにかして Activity を置き換えない方式にできないか?

Android: テクスチャを生成するタイミングが遅い(ノイズが乗る)

起動時やバックグラウンドからの復帰時に、文字が入るはずのテクスチャがノイズになってしまっている場合があります。現状の実装では一度 Update を通過しないとテクスチャが生成されない仕様になっていますが、このノイズが入るタイミングでは、Update が呼ばれることなく Render が走っているのではないかと思います。

Update 内に置いている処理をいくつか OnPreRender 等へ移すことで解決するのではないかと思います。

Android: OpenGL ES 2.0 に対応していない

OpenGL surface の生成時に OpenGL ES 1.0 を決めうちしてしまっているために、OpenGL ES 2.0 を使用することができません。

ちなみに ExtendedUnityPlayer の init の第一引数を 2 に変更する事で対応できるかどうか試してみましたが、画面がブラックアウトしてしまいます。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.