The emitter carries the invisible material, whose alpha is 0, so an exhaust prefab left at Unity's default (Use Mesh Colors on) emitted nothing. The shipped thruster prefabs only worked because theirs is off. ThrusterHardpoint .WireExhaust now owns the wiring and turns it off; ShipInstance calls it. The preview smoke wires a default particle system to each emitter on the clone and requires every particle emitted and none transparent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
667 B
C#
16 lines
667 B
C#
using UnityEngine;
|
|
|
|
public class ThrusterHardpoint : MonoBehaviour
|
|
{
|
|
public MeshRenderer Emitter;
|
|
|
|
// Points an exhaust's shape at a hardpoint's emitter, or at nothing when the ship has no such hardpoint. The emitter
|
|
// carries the invisible material (alpha 0), so the particles never take their colour from its mesh: with Use Mesh
|
|
// Colors on, Unity's default, they would all be born transparent.
|
|
public static void WireExhaust(ParticleSystem exhaust, ThrusterHardpoint hardpoint)
|
|
{
|
|
var shape = exhaust.shape;
|
|
shape.useMeshColors = false;
|
|
shape.meshRenderer = hardpoint != null ? hardpoint.Emitter : null;
|
|
}
|
|
}
|