public void PresetVariables(List <SharedVariable> variables) { foreach (var preVar in variables) { SharedVariable variable = Variables.Find(x => x.name == preVar.name); if (variable != null) { variable.SetValue(preVar.GetValue()); } } }
public void PresetVariables(List <SharedVariable> variables) { if (!IsInstance) { Debug.LogError($"尝试预设未实例化的行为树:{(Executor ? $"{Executor.gameObject.name}." : string.Empty)}{name}"); return; } foreach (var preVar in variables) { SharedVariable variable = Variables.Find(x => x.name == preVar.name); if (variable != null) { variable.SetValue(preVar.GetValue()); } } }