18-06-2020, 02:02 PM
(This post was last modified: 18-06-2020, 02:07 PM by hungseparate.)
I'm not sure if i got it right, but it not working so well
First of all, i using 2 emitters, 2 blueprints
Then i put color data into userdata when particle emit
After that, i set color in LateUpdate
Nvm, i figure it out now.
My code is working fine, but color field in "Obi Particle Renderer" component mess it up, after set it back to "White", it look good now !
Btw, thanks for your help, great asset but lack of documents
I think you should update document with these info, that'll be great !
First of all, i using 2 emitters, 2 blueprints
Then i put color data into userdata when particle emit
Code:
private void _actor_OnEmitParticle(ObiEmitter emitter, int particleIndex)
{
if (emitter.solver != null)
{
int k = emitter.solverIndices[particleIndex];
Vector4 userData = emitter.solver.userData[k];
userData[0] = emitter.solver.colors[k].r;
userData[1] = emitter.solver.colors[k].g;
userData[2] = emitter.solver.colors[k].b;
emitter.solver.userData[k] = userData;
}
}
After that, i set color in LateUpdate
Code:
private void LateUpdate()
{
for (int i = 0; i < _actor.solverIndices.Length; ++i)
{
int k = _actor.solverIndices[i];
Vector4 userData = _actor.solver.userData[k];
_actor.solver.colors[k] = new Color(userData[0], userData[1], userData[2]);
}
}
Nvm, i figure it out now.
My code is working fine, but color field in "Obi Particle Renderer" component mess it up, after set it back to "White", it look good now !
Btw, thanks for your help, great asset but lack of documents
I think you should update document with these info, that'll be great !