playMaker

Author Topic: Graphics.activeTier (Shader Quality)  (Read 9138 times)

Meka Games

  • Junior Playmaker
  • **
  • Posts: 61
Graphics.activeTier (Shader Quality)
« on: April 13, 2018, 04:44:03 AM »
Hello. I want to add a Shader Quality setting to my game. For this, i should change the Shader Tier from "Edit>Project Settings>Graphics"

This is actually something that is done automatically by unity but I still want to add it as a setting on the options menu.

https://docs.unity3d.com/ScriptReference/Graphics-activeTier.html

Thanks.

Meka Games

  • Junior Playmaker
  • **
  • Posts: 61
Re: Graphics.activeTier (Shader Quality)
« Reply #1 on: April 13, 2018, 07:46:35 AM »
Ok I created a script myself. Works great.

Code: [Select]
using UnityEngine;
using System;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("QualitySettings")]
[Tooltip("Shader hardware tier classification for current device.")]
public class SetGlobalShaderHardwareTier2 : FsmStateAction
{
public override void OnEnter()
{

UnityEngine.Shader.globalShaderHardwareTier = UnityEngine.Rendering.ShaderHardwareTier.Tier2;

Finish();
}
}
}

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7620
    • jinxtergames
Re: Graphics.activeTier (Shader Quality)
« Reply #2 on: April 13, 2018, 02:22:17 PM »
Hi.
Thanks for sharing the script :)

I tested it but i got some obselete warnigs so i rewrote the script.
i also set an enum so you could select the other tiers :

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2014. All rights reserved.
/*--- __ECO__ __PLAYMAKER__ __ACTION__ ---*/
// keywords : shader quality , shaderquality , globalShaderHardwareTier , ShaderHardwareTier

using UnityEngine;
using System;

namespace HutongGames.PlayMaker.Actions
{
    [ActionCategory("QualitySettings")]
    [Tooltip("Shader hardware tier classification for current device.")]
    public class SetGraphicsActiveTier : FsmStateAction
    {
        [Tooltip("The torque forceMode")]
        [ObjectType(typeof(UnityEngine.Rendering.GraphicsTier))]
        public FsmEnum tier;


        public override void OnEnter()
        {
            Graphics.activeTier = (UnityEngine.Rendering.GraphicsTier)tier.Value;
            Finish();
        }
    }
}


I also gave a different name and added it to the Ecosystem

Could you test if it works?

Search for : Set Graphics Active Tier

Meka Games

  • Junior Playmaker
  • **
  • Posts: 61
Re: Graphics.activeTier (Shader Quality)
« Reply #3 on: April 13, 2018, 03:01:07 PM »
Hi.
Thanks for sharing the script :)

I tested it but i got some obselete warnigs so i rewrote the script.
i also set an enum so you could select the other tiers :

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2014. All rights reserved.
/*--- __ECO__ __PLAYMAKER__ __ACTION__ ---*/
// keywords : shader quality , shaderquality , globalShaderHardwareTier , ShaderHardwareTier

using UnityEngine;
using System;

namespace HutongGames.PlayMaker.Actions
{
    [ActionCategory("QualitySettings")]
    [Tooltip("Shader hardware tier classification for current device.")]
    public class SetGraphicsActiveTier : FsmStateAction
    {
        [Tooltip("The torque forceMode")]
        [ObjectType(typeof(UnityEngine.Rendering.GraphicsTier))]
        public FsmEnum tier;


        public override void OnEnter()
        {
            Graphics.activeTier = (UnityEngine.Rendering.GraphicsTier)tier.Value;
            Finish();
        }
    }
}


I also gave a different name and added it to the Ecosystem

Could you test if it works?

Search for : Set Graphics Active Tier

Thanks, its working great and better script!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7620
    • jinxtergames
Re: Graphics.activeTier (Shader Quality)
« Reply #4 on: April 13, 2018, 08:30:56 PM »
Hi.
Thanks for testing !

Don't stop making actions when needed and post it here, it can always benefit someone :)

and the more you play around with the scripts the easier it gets :)

also feel free to ask, if you get stuck :D

Meka Games

  • Junior Playmaker
  • **
  • Posts: 61
Re: Graphics.activeTier (Shader Quality)
« Reply #5 on: April 20, 2018, 09:37:28 AM »
Hi.
Thanks for testing !

Don't stop making actions when needed and post it here, it can always benefit someone :)

and the more you play around with the scripts the easier it gets :)

also feel free to ask, if you get stuck :D

Hey djaydino,

This thing is working great on Editor. But when I build my game, it's not working.
Do you know why?

I really want to change the shader quality on the options menu. This leads to more optimization.

Thanks!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7620
    • jinxtergames
Re: Graphics.activeTier (Shader Quality)
« Reply #6 on: April 20, 2018, 04:55:30 PM »
Hi.

Did you try also with your action?

What platform are you building to?

I got a feeling that this only works in the editor.
As i can only find editor scripts for them.

Maybe you need to look in quality settings, there are some quality actions on the Ecosystem.

Meka Games

  • Junior Playmaker
  • **
  • Posts: 61
Re: Graphics.activeTier (Shader Quality)
« Reply #7 on: April 21, 2018, 07:13:45 AM »
Hi.

Did you try also with your action?

What platform are you building to?

I got a feeling that this only works in the editor.
As i can only find editor scripts for them.

Maybe you need to look in quality settings, there are some quality actions on the Ecosystem.

My build target is Windows PC.
I also tried with my action.

...It seems so.

I hope someone can answer this question.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7620
    • jinxtergames
Re: Graphics.activeTier (Shader Quality)
« Reply #8 on: April 21, 2018, 01:03:03 PM »
Hi.
I went on GDL Discord channel and they confirmed it,
Maybe Shader LOD can help?

https://docs.unity3d.com/Manual/SL-ShaderLOD.html

Meka Games

  • Junior Playmaker
  • **
  • Posts: 61
Re: Graphics.activeTier (Shader Quality)
« Reply #9 on: April 21, 2018, 04:21:30 PM »
Hi.
I went on GDL Discord channel and they confirmed it,
Maybe Shader LOD can help?

https://docs.unity3d.com/Manual/SL-ShaderLOD.html

Alright! Thanks.

Here's my script:

Code: [Select]
using UnityEngine;
using System;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("QualitySettings")]
[Tooltip("Shader LOD level for all shaders.")]
public class SetGlobalMaximumLOD : FsmStateAction
{

[RequiredField]
[Tooltip("")]
public FsmInt amount;

public override void Reset()
{
amount = null;
}

public override void OnEnter()
{

UnityEngine.Shader.globalMaximumLOD = (amount.Value);

Finish();
}
}
}
« Last Edit: April 22, 2018, 03:53:54 AM by haratman »

SawyerK

  • Junior Playmaker
  • **
  • Posts: 94
Re: Graphics.activeTier (Shader Quality)
« Reply #10 on: January 20, 2022, 08:22:52 AM »
Does this action still works? I can't seem to find it on the Ecosystem.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7620
    • jinxtergames
Re: Graphics.activeTier (Shader Quality)
« Reply #11 on: January 20, 2022, 10:29:45 AM »
Hi.
They might not be on the Ecosystem.

But you can create a c# script and copy paste the code.
give the script the same name as the Class name, so its easier to find (SetGlobalMaximumLOD in this case)

I have set a bookmark so i can add to the ecosystem when i have time :)