I've been making a manager for decals on walls that conforms to the face by normals and it mainly consists of a particle system that uses.emit to put out a single particle (in this case the decal) at the point and normal vector of a collision that can be passed to the method. It works beautifully in the editor without any problems from 1 particle to 1000 at any point, but as soon as I try to open up a build of the game the blood doesn't appear at all. I've tried switching shaders, double sided shaders, and all of the options I can think of in the inspector, but since the particles are emitted through code I don't really use any of the modules so all I can extensively check are renderer and main settings. I also tried putting the system directly in front of camera as a child, but no luck. I have included screenshots below of the system's settings and a picture of the decals working in the editor and code below.
I've been stumped for a while now by this and I would really appreciate to hear what you guys think can help me out. Thank you in advance!
private ParticleSystem ps;
void Start()
{
ps = gameObject.GetComponent<ParticleSystem>();
}
public void SpawnBlood(Vector3 pos, Vector3 normals)
{
float x = normals.x * .01f;
float y = normals.y * .01f;
float z = normals.z * .01f;
// moving position away from wall
var emitParams = new ParticleSystem.EmitParams();
emitParams.position = pos + new Vector3(x, y, z);
emitParams.rotation3D = Quaternion.FromToRotation(Vector3.forward, normals).eulerAngles;
ps.Emit(emitParams, 1);
//Debug.Log(normals);
}
It was due to the variable.isStatic only working in editor.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.