I can't seem to help myself and stop coding...
Here's a Get and then a Set playmaker actions for procedural skyboxes all the parameters of the shader are included.
Get:
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Skybox")]
[Tooltip("Gets material settings of a procedural skybox")]
public class GetProceduralSkyboxProperties : FsmStateAction
{
private Material ProceduralSkyBox;
[UIHint(UIHint.Variable)]
public FsmFloat SunSize;
[UIHint(UIHint.Variable)]
public FsmFloat AtmosphereThickness;
[UIHint(UIHint.Variable)]
public FsmColor SkyTint;
[UIHint(UIHint.Variable)]
public FsmColor GroundColor;
[UIHint(UIHint.Variable)]
public FsmFloat exposure;
public bool everyFrame;
// public override void Reset()
// {
// everyFrame = false;
// SunSize = null;
// AtmosphereThickness = null;
// SkyTint = null;
// GroundColor = null;
// exposure = null;
//
// }
public override void OnEnter()
{
if (RenderSettings.skybox.shader.name != "Skybox/Procedural")
Finish ();
ProceduralSkyBox = RenderSettings.skybox;
SunSize.Value = ProceduralSkyBox.GetFloat("_SunSize");
AtmosphereThickness.Value = ProceduralSkyBox.GetFloat("_AtmosphereThickness");
SkyTint.Value = ProceduralSkyBox.GetColor("_SkyTint");
GroundColor.Value = ProceduralSkyBox.GetColor("_GroundColor");
exposure.Value = ProceduralSkyBox.GetFloat("_Exposure");
if (!everyFrame)
{
Finish();
}
}
}
}
Set:
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Skybox")]
[Tooltip("Sets the material settings of a procedural skybox")]
public class SetProceduralSkyboxProperties : FsmStateAction
{
private Material ProceduralSkyBox;
[UIHint(UIHint.Variable)]
public FsmFloat SunSize;
[UIHint(UIHint.Variable)]
public FsmFloat AtmosphereThickness;
[UIHint(UIHint.Variable)]
public FsmColor SkyTint;
[UIHint(UIHint.Variable)]
public FsmColor GroundColor;
[UIHint(UIHint.Variable)]
public FsmFloat exposure;
public bool everyFrame;
public override void Reset()
{
ProceduralSkyBox = null;
everyFrame = false;
SunSize = null;
AtmosphereThickness = null;
SkyTint = null;
GroundColor = null;
exposure = null;
}
public override void OnEnter()
{
if (RenderSettings.skybox.shader.name != "Skybox/Procedural")
Finish ();
ProceduralSkyBox = RenderSettings.skybox;
if (ProceduralSkyBox != null)
{
if(!SunSize.IsNone)
{
ProceduralSkyBox.SetFloat("_SunSize",SunSize.Value);
}
if(!AtmosphereThickness.IsNone)
{
ProceduralSkyBox.SetFloat("_AtmosphereThickness",AtmosphereThickness.Value);
}
if(!SkyTint.IsNone)
{
ProceduralSkyBox.SetColor("_SkyTint",SkyTint.Value);
}
if(!GroundColor.IsNone)
{
ProceduralSkyBox.SetColor("_GroundColor",GroundColor.Value);
}
if(!exposure.IsNone)
{
ProceduralSkyBox.SetFloat("_Exposure",exposure.Value);
}
}
if (!everyFrame)
{
Finish();
}
}
public override void OnUpdate()
{
if (ProceduralSkyBox != null)
{
if(!SunSize.IsNone)
{
ProceduralSkyBox.SetFloat("_SunSize",SunSize.Value);
}
if(!AtmosphereThickness.IsNone)
{
ProceduralSkyBox.SetFloat("_AtmosphereThickness",AtmosphereThickness.Value);
}
if(!SkyTint.IsNone)
{
ProceduralSkyBox.SetColor("_SkyTint",SkyTint.Value);
}
if(!GroundColor.IsNone)
{
ProceduralSkyBox.SetColor("_GroundColor",GroundColor.Value);
}
if(!exposure.IsNone)
{
ProceduralSkyBox.SetFloat("_Exposure",exposure.Value);
}
}
}
}
}