diff --git a/Assets/Scripts/Editor/ShipModPreview.cs b/Assets/Scripts/Editor/ShipModPreview.cs index 090917d9e..64f9ea6b7 100644 --- a/Assets/Scripts/Editor/ShipModPreview.cs +++ b/Assets/Scripts/Editor/ShipModPreview.cs @@ -65,7 +65,8 @@ public static class ShipModPreview ship.HullColliders[0].GetComponent() != null, "one hull collider with a MeshCollider"); Require(Inside(ship.MapIcon) && Inside(ship.Shield) && Inside(ship.TractorBeam), "map icon, shield and tractor inside the ship"); Require(ship.ThrusterHardpoints.Select(node => node.name).SequenceEqual(plan.Thrusters) && - ship.ThrusterHardpoints.All(node => Inside(node) && Inside(node.Emitter) && node.Emitter.forceRenderingOff), + ship.ThrusterHardpoints.All(node => Inside(node) && Inside(node.Emitter) && + node.Emitter.sharedMaterials.All(material => material == ship.InvisibleMaterial)), "thruster hardpoints with unrendered emitter meshes"); Require(ship.RadiatorHardpoints.Select(node => node.name).SequenceEqual(plan.Radiators) && ship.RadiatorHardpoints.All(node => Inside(node) && Inside(node.Mesh)), "radiator hardpoints with meshes"); diff --git a/Assets/Scripts/Gameplay/ShipModShips.cs b/Assets/Scripts/Gameplay/ShipModShips.cs index d60dc2a8c..354a1e4a6 100644 --- a/Assets/Scripts/Gameplay/ShipModShips.cs +++ b/Assets/Scripts/Gameplay/ShipModShips.cs @@ -123,9 +123,11 @@ public static class ShipModShips var thrusters = plan.Thrusters.Select(id => { // The thruster's mesh is its exhaust's emission surface, never drawn (ruling thrusters-radiators-are-meshes). + // The invisible material is serialized, so it survives the prototype's clone, and EntityInstance keeps it as + // this renderer's visible material; forceRenderingOff would not survive Instantiate. var hardpoint = AddOrGet(Node(id).gameObject); hardpoint.Emitter = Renderer(id); - hardpoint.Emitter.forceRenderingOff = true; + hardpoint.Emitter.sharedMaterials = Enumerable.Repeat(template.Invisible, hardpoint.Emitter.sharedMaterials.Length).ToArray(); return hardpoint; }).ToArray(); var radiators = plan.Radiators.Select(id =>