I have typed this script that handles Unity's logging and blocks it. It's different than Playmaker's own logging which can also be blocked.
using UnityEngine;
using System.Collections;
//https://docs.unity3d.com/ScriptReference/Logger-logEnabled.html https://docs.unity3d.com/ScriptReference/Debug-isDebugBuild.html
//code by Broken Stylus (2022)
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Debug)]
[Tooltip("Enable or disable logging at runtime. This only affects the Unity Console, not Playmaker's Fsm Log. Can be set to depend on the option 'Development Build' in Build Settings.")]
public class EnableBuildLogging : FsmStateAction
{
[Title("Enable logging")]
[Tooltip("Allow the build to send logs.")]
public FsmBool logEnabled;
[Title("Development build only")]
[Tooltip("Set to TRUE to allow logging only if the build is in development mode. Will not matter if no logging is enabled anyway.")]
public FsmBool devBuildOnly;
private static ILogger logger = Debug.unityLogger;
public override void Reset()
{
logEnabled = false;
devBuildOnly = true;
}
public override void OnEnter()
{
if(logEnabled.Value)
{
if (devBuildOnly.Value && !Debug.isDebugBuild) // verifies that the logging must only happen in Development Build mode, and checks if the build is in release mode (not in dev mode), in which case the logging is not allowed and the process is aborted. All other cases in this area of the code will allow the logging.
{
Finish();
}
logger.logEnabled = logEnabled.Value;
}
Finish();
}
}
}
But I'm not sure it's working properly. The idea is to render Unity totally mute. I added a condition, up to the user, to restrain the logging to a development build.
Does this action look good?