class
BeamEffect
public sealed class BeamEffect : Component The BeamEffect component creates a visual beam effect in the scene, simulating a continuous line or laser-like effect. Unlike LineRenderer these beams can change over time, spawn multiple instances, and have various properties like color, texture, and lifetime. This is a useful component for creating things like laser beams, energy effects and tracers.
Constructors
BeamEffect() Properties
| Name | Type | Description |
|---|---|---|
Scale | ParticleFloat | Thickness of the beam in world units. Controls how wide the beam appears. |
TargetPosition | Vector3 | World position the beam targets if no target object is set. Used as the endpoint for the beam. |
TargetGameObject | GameObject | GameObject to target with the beam. If assigned, overrides TargetPosition and uses the object's world position as the endpoint. |
TargetRandom | Vector3 | Random offset applied to the target position for visual variation. Adds randomness to the endpoint. |
FollowPoints | Boolean | If true, the beam endpoints follow their source and target positions each frame, updating dynamically. |
BeamsPerSecond | Single | Number of beams spawned per second. Controls the spawn rate for continuous effects. |
MaxBeams | Int32 | Maximum number of beams that can exist at once. Limits the total active beams. |
InitialBurst | Int32 | Number of beams spawned immediately when the effect is enabled. |
BeamLifetime | ParticleFloat | Lifetime of each beam in seconds. Determines how long a beam remains before being removed or respawned. |
Looped | Boolean | If true, beams respawn automatically when they expire, creating a looping effect. |
Texture | Texture | Texture applied to the beam. Defines the visual appearance along the beam's length. |
Material | Material | Material applied to the beam. Defines the visual appearance along the beam's length. The material should be based on the `line.shader`. |
TextureOffset | ParticleFloat | Offset of the texture along the beam. Shifts the texture start position. |
TextureScale | ParticleFloat | Scale of the texture along the beam. Controls how many world units each texture tile covers. |
TextureScrollSpeed | ParticleFloat | Speed at which the texture scrolls along the beam. Positive values scroll in one direction, negative in the other. |
TextureScroll | ParticleFloat | This is pretty much the same as TextureOffset - but it's seperate so you can use offset for offset, and scroll to scroll. |
FilterMode | FilterMode | Controls texture filtering on this beam effect. |
BeamColor | ParticleGradient | Color gradient of the beam over its lifetime. Defines how the color changes from birth to death. |
Alpha | ParticleFloat | Alpha multiplier for the beam's color. Controls transparency over the beam's lifetime. |
Brightness | ParticleFloat | Brightness multiplier for the beam's color. Adjusts intensity over the beam's lifetime. |
Additive | Boolean | If true, the beam is rendered additively, making it appear to glow. |
Shadows | Boolean | If true, the beam casts shadows in the scene. |
Lighting | Boolean | If true, the beam is affected by scene lighting. |
Opaque | Boolean | If true, the beam is rendered as opaque rather than transparent. |
DepthFeather | Single | Amount of feathering applied to the beam's depth, softening its intersection with geometry. |
TravelBetweenPoints | Boolean | If true, the beam visually travels from start to end, useful for tracer effects. |
TravelLerp | ParticleFloat | Controls the interpolation of the beam's travel effect over its lifetime. |
Methods
BeamInstance SpawnBeam() Spawns a new beam and adds it to the effect.