This is handy if you have a day and night system. I use this with the Ease Color action to change my sky.
// (c) Copyright HutongGames, LLC 2010-2012. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Camera)]
[Tooltip("Set the background color of a camera")]
public class SetCameraBackgroundColor : FsmStateAction
{
[RequiredField]
[CheckForComponent(typeof(Camera))]
[Tooltip("The camera.")]
public FsmOwnerDefault camera;
[RequiredField]
[Tooltip("Background color")]
public FsmColor color;
[Tooltip("Repeat every frame.")]
public bool everyFrame;
private Camera cam;
public override void Reset()
{
camera = null;
color = null;
}
public override void OnEnter()
{
var go = Fsm.GetOwnerDefaultTarget(camera);
if (go == null)
{
return;
}
cam = go.camera;
if (cam==null)
{
return;
}
DoSetColor();
if (!everyFrame)
{
Finish();
}
}
public override void OnUpdate()
{
DoSetColor();
}
void DoSetColor()
{
cam.backgroundColor = color.Value;
}
}
}
This script is based on Jean's CameraSetOrthographicSize.