Version: 2022.1
言語: 日本語
パーティクルシステム GPU インスタンス
コンポーネントとモジュール

パーティクルシステム C# Job System インテグレーション

パーティクルシステムは、Unity の C# Job System を使用して独自の動作をパーティクルに適用できます。

Unity は C# Job System からの作業をワーカースレッドに分配し、Burst コンパイラーを利用します。GetParticles()SetParticles() メソッドは同様の機能を提供しますが、メインスレッドで実行され、Unity の Burst コンパイラーを使用することはできません。

By default, a Particle System job only has access to one or more particles belonging to that Particle System. Unity passes this data to the job using a ParticleSystemJobData struct. You must pass any other data that the job requires as additional parameters.

パーティクルデータにアクセスするために、Unity は以下のジョブタイプをサポートします。

IJobParticleSystem

このジョブタイプは、1 つのワーカースレッドで 1 つのジョブを実行します。ジョブは、パーティクルシステムに属するすべてのパーティクルにアクセスできます。このジョブタイプのコード例は、IJobParticleSystem.Execute() のスクリプトリファレンスを参照してください。

IJobParticleSystemParallelFor

This job type executes multiple jobs across multiple worker threads. Each job can only access the particle at the index specified by the job’s Execute() function. For example code on this job type, see the IJobParticleSystemParallelFor.Execute() Scripting reference.

IJobParticleSystemParallelForBatch

This job type executes multiple jobs across multiple worker threads. Each job can only access the particles within the range specified by the job’s Execute() function. For example code on this job type, see the IJobParticleSystemParallelForBatch.Execute() Scripting reference.

Burst

他の C# ジョブと同様に、Burst コンパイラーを使用して、パーティクルジョブを高度に最適化されたBurst ジョブにコンパイルできます。詳細は、Burst コンパイラーに関するドキュメント を参照してください。

Unity 2019.3 の新機能

パーティクルシステム GPU インスタンス
コンポーネントとモジュール