playMaker

Author Topic: Help with modifying custom action?  (Read 596 times)

joshua121

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Help with modifying custom action?
« on: January 14, 2017, 10:55:02 AM »
Hi,

I found this action in the forums and it targets the exposure of the procedural skybox. The only problem with it is that it only sets the exposure with a static number and does not have the option of using a variable.

I would like to modify the code to allow for the use of a float variable for the exposure.

I do not know much of anything about code, and though I've been trying to figure this out for hours I've had no luck. Any help would be greatly appreciated.

Here is the code.

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Skybox")]
[Tooltip("Allows Adjustment of Procedural Skybox")]
public class SkyBoxAdjust : FsmStateAction
{


public Material ProceduralSkyBox;
public bool everyFrame;
public float exposure;

public override void Reset()
{

ProceduralSkyBox = null;
everyFrame = false;

}

public override void OnEnter()
{
if (ProceduralSkyBox != null && exposure != null)
{
ProceduralSkyBox.SetFloat

("_Exposure",exposure);
}

if (!everyFrame)
{
Finish();
}
}

public override void OnUpdate()
{
if (ProceduralSkyBox != null && exposure != null)
{
ProceduralSkyBox.SetFloat

("_Exposure",exposure);
}
}

}
}

Chizzler

  • Junior Playmaker
  • **
  • Posts: 67
    • View Profile
Re: Help with modifying custom action?
« Reply #1 on: January 14, 2017, 01:32:23 PM »
Alright, I can't promise this'll work as i don't have much coding experience either. It's not throwing up any errors in the console though, and lets me input a variable. Give it a try and let me know =)

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Skybox")]
[Tooltip("Allows Adjustment of Procedural Skybox")]
public class SkyBoxAdjust : FsmStateAction
{


public Material ProceduralSkyBox;
public bool everyFrame;
[RequiredField]
public FsmFloat exposure;

public override void Reset()
{

ProceduralSkyBox = null;
everyFrame = false;
exposure = null;

}

public override void OnEnter()
{
if (ProceduralSkyBox != null && exposure != null)
{
ProceduralSkyBox.SetFloat

("_Exposure",exposure.Value);
}

if (!everyFrame)
{
Finish();
}
}

public override void OnUpdate()
{
if (ProceduralSkyBox != null && exposure != null)
{
ProceduralSkyBox.SetFloat

("_Exposure",exposure.Value);
}
}

}
}

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14059
  • Official Playmaker Support
    • View Profile
Re: Help with modifying custom action?
« Reply #2 on: February 28, 2017, 10:46:42 PM »
Hi,

 Have you tried "SetMaterialFloat", you can set the exposure property with that action I think, did you tried and it didn't work?

 Bye,

 Jean