Compare Strings#
Compare / Compare Strings
Description#
Returns true if two Strings are equal
Parameters#
| Name | Description |
|---|---|
| Value 1 | The String targeted |
| Value 2 | The String to compare against |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Compare Strings")]
[Image(typeof(IconString), ColorTheme.Type.Yellow)]
[Description("Returns true if two Strings are equal")]
[Category("Compare/Compare Strings")]
[Parameter("Value 1", "The String targeted")]
[Parameter("Value 2", "The String to compare against")]
[Keywords("Check", "Equals", "Same")]
[Serializable]
public class ConditionCoreCompareString : Condition
{
[SerializeField] private GetString m_Value1 = new GetString();
[SerializeField] private GetString m_Value2 = new GetString();
protected override string GetTitle(GameObject source) => $"{this.m_Value1} = {this.m_Value2}";
protected override bool Run(Args args)
{
string value1 = this.m_Value1.Get(args);
string value2 = this.m_Value2.Get(args);
return value1 == value2;
}
}
}