Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: brainchildbc on September 16, 2016, 02:17:36 PM

Title: Writing debug output to txt file
Post by: brainchildbc on September 16, 2016, 02:17:36 PM
Hi,

I am using a visual scripting language (playmaker) to continuously track distance between two objects and save those values in a float variable. Now I want to debug that float variable and output the debug log to a txt file. Could someone help me in doing so?

(please keep in mind I am a n00b and have no prior coding experience :) )

Code: [Select]

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Debug)]
[Tooltip("Logs the value of a Float Variable in the PlayMaker Log Window.")]
public class DebugFloat : BaseLogAction
{
        [Tooltip("Info, Warning, or Error.")]
        public LogLevel logLevel;

        [UIHint(UIHint.Variable)]
        [Tooltip("The Float variable to debug.")]
public FsmFloat floatVariable;

public override void Reset()
{
logLevel = LogLevel.Info;
floatVariable = null;
            base.Reset();
}

public override void OnEnter()
{
string text = "None";

if (!floatVariable.IsNone)
{
text = floatVariable.Name + ": " + floatVariable.Value;
}

ActionHelpers.DebugLog(Fsm, logLevel, text, sendToUnityLog);

Finish();
}
}
}


If possible can someone tell me where I need to insert what code exactly for this to work?


Many thanks!!
Title: Re: Writing debug output to txt file
Post by: djaydino on September 18, 2016, 07:51:46 AM
Hi,
Maybe this (https://docs.unity3d.com/Manual/LogFiles.html) can help you.

You can use the "Debug Float" Action and "Check" Send to unity log.