Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Silicon Power on April 03, 2023, 09:57:58 PM

Title: Change shadow distance at runtime?
Post by: Silicon Power on April 03, 2023, 09:57:58 PM
Hi I need to change shadow distance at the runtime is there any action to do this for me?
Title: Re: Change shadow distance at runtime?
Post by: djaydino on April 04, 2023, 07:43:42 AM
Hi.
I did a quick search and from what I understand you can't change it directly.

what might be possible is to setup different quality settings.
Then Set Quality Level (Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)) to change
Title: Re: Change shadow distance at runtime?
Post by: Silicon Power on April 04, 2023, 10:04:26 AM
Hi.
I did a quick search and from what I understand you can't change it directly.

what might be possible is to setup different quality settings.
Then Set Quality Level (Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)) to change

Thank you what about get quality? I need to get quality first
Title: Re: Change shadow distance at runtime?
Post by: Christoph on April 04, 2023, 10:59:29 PM
Wouldn’t that be it?

https://forum.unity.com/threads/change-max-shadow-distance-at-runtime.1325874/
Title: Re: Change shadow distance at runtime?
Post by: Silicon Power on April 07, 2023, 12:33:36 PM
Wouldn’t that be it?

https://forum.unity.com/threads/change-max-shadow-distance-at-runtime.1325874/

Hi thank you. Can you please make a playmaker action from this? I use default render pipleline
Title: Re: Change shadow distance at runtime?
Post by: NolanBoisvert on April 13, 2023, 09:53:20 AM
Thanks for the link.The shadow remains unchanged. While searching online for writing an essay draught since I don't know how to do it. I asked my friend and he told me to visit this site right here (https://writinguniverse.com/essay-draft/) writinguniverse.com/essay-draft that will instructs me on how to do it. This helps me to complete my essay assignment on the time and I will write my essay easily.
Title: Re: Change shadow distance at runtime?
Post by: Christoph on April 13, 2023, 02:00:46 PM
Wouldn’t that be it?

https://forum.unity.com/threads/change-max-shadow-distance-at-runtime.1325874/

Hi thank you. Can you please make a playmaker action from this? I use default render pipleline
Sure. Here you go:

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("QualitySettings")]
[Tooltip("Sets the Shadow Distance from the Project Quality Settings at runtime.")]
public class SetShadowDistance : FsmStateAction
{
[RequiredField]
[Tooltip("The Shadow Distance to set.")]
public FsmFloat shadowDistance;

[Tooltip("Repeat every frame while the state is active.")]
public bool everyFrame;

public override void Reset()
{
shadowDistance = 0f;
everyFrame = false;
}

public override void OnEnter()
{
DoSetShadowDistance();

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

public override void OnUpdate()
{
DoSetShadowDistance();
}

public void DoSetShadowDistance()
        {
QualitySettings.shadowDistance = shadowDistance.Value;
}
}
}

Action is also attached so just drag it into your project. I tested it in my project and seems to work fine. I also added a 'everyframe' bool option so you could tween it if needed over time.

Cheers!