Class ScreenShakeChannel
Feedback channel that produces camera positional shake via a decaying jitter coroutine.
Handles ScreenShakeEffect. Resolves the camera lazily via UnityEngine.Camera.main;
call RegisterCamera(Transform) to override with a custom rig. The offset is applied through a
UnityCameraShakeApplier (added to the camera automatically) so it survives a camera
controller that sets the camera's position every frame. Uses unscaled time so it survives a hit-stop.
UI shake lives in its own channel (UiScreenShakeChannel).
Inheritance
ScreenShakeChannel
Assembly: Serenity.UnityFeedback.Infrastructure.dll
Syntax
public class ScreenShakeChannel : IFeedbackChannel
Constructors
ScreenShakeChannel(IFeedbackRuntime)
Initializes a new ScreenShakeChannel.
Declaration
public ScreenShakeChannel(IFeedbackRuntime runtime)
Parameters
| Type |
Name |
Description |
| IFeedbackRuntime |
runtime |
Coroutine host used to run and cancel the shake decay routine.
|
Properties
ChannelId
Declaration
public string ChannelId { get; }
Property Value
Methods
CanPlay(IFeedbackEffect)
Declaration
public bool CanPlay(IFeedbackEffect effect)
Parameters
Returns
Play(FeedbackTarget, IFeedbackEffect)
Declaration
public void Play(FeedbackTarget target, IFeedbackEffect effect)
Parameters
Registers a custom camera transform to shake instead of UnityEngine.Camera.main.
Call this from your camera rig setup code when the main camera is not tagged "MainCamera".
Declaration
public void RegisterCamera(Transform cameraTransform)
Parameters
| Type |
Name |
Description |
| Transform |
cameraTransform |
The transform to offset during shake.
|
Stop(FeedbackTarget)
Declaration
public void Stop(FeedbackTarget target)
Parameters
StopAll()
Declaration
Implements