Cinemachine のピクセルパーフェクト拡張機能の使用
Pixel Perfect Camera と Cinemachine はどちらもカメラの平行投影サイズを変更します。単一のシーンでこの 2 つのシステムを一緒に使用すると、カメラの制御について対立が発生し、望ましくない結果が生じます。Cinemachine のピクセルパーフェクト 拡張機能はこの対立を解決します。
Cinemachine のピクセルパーフェクト は、バーチャルカメラの平行投影サイズを変更する、Cinemachine Virtual Camera 向けの 拡張機能 です。Pixel Perfect Camera コンポーネントの存在を検出し、このコンポーネントの設定を使用して、ピクセルパーフェクトな解像度でスプライトを最適に保持するバーチャルカメラの正確な平行投影サイズを計算します。
この拡張機能をバーチャルカメラに追加するには、Cinemachine Virtual Camera の Inspector ウィンドウにある Add Extension ドロップダウンメニューを使用します。プロジェクトの各バーチャルカメラにこの拡張機能を追加します。

次に Pixel Perfect Camera コンポーネントは、この拡張機能がアタッチされたバーチャルカメラごとに、Play Mode 中または Run In Edit Mode が有効になっている場合に、バーチャルカメラの元のサイズに最もマッチするピクセルパーフェクトな平行投影サイズを計算します。これは、ピクセルパーフェクトの計算が実行されたときに、各バーチャルカメラの元のフレーミングにできるだけ一致させるために行われます。
Cinemachine Brain コンポーネントで複数のバーチャルカメラを ブレンド する場合、カメラ間の遷移の間は、レンダリングされる画像が一時的にピクセルパーフェクトではなくなります。ビューが単一のバーチャルカメラに完全に遷移すると、画像はピクセルパーフェクトになります。
拡張機能の現在の制限は以下のとおりです。
- ピクセルパーフェクト拡張機能を使用するバーチャルカメラが ターゲットグループ を追跡するよう設定されている場合、バーチャルカメラが Framing Transposer コンポーネントで配置されていると、目に見えるもたつきが発生する可能性があります。
- Pixel Perfect Camera で Upscale Render Texture オプションが有効になっている場合、バーチャルカメラの元の平行投影サイズに一致するピクセルパーフェクト解像度の候補が少なくなります。これにより、ピクセルパーフェクトの計算後、バーチャルカメラのフレーミングがかなり大きくずれることがあります。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.