playMaker

Author Topic: Bug in FsmVariables.ApplyVariableValuesCarefully  (Read 875 times)

Amitloaf

  • Playmaker Newbie
  • *
  • Posts: 9
Bug in FsmVariables.ApplyVariableValuesCarefully
« on: July 29, 2020, 04:02:27 AM »
There's just copy paste issues there and the method is completely broken. Because playmaker adds weird empty variables from time to time, I need this method to set variables or it mixes them up. (I fixed it locally by reimplementing this method but it should be fixed):

Code: [Select]
for (int index = 0; index < source.IntVariables.Length; ++index)
      {
        FsmInt fsmInt = this.FindFsmInt(source.IntVariables[index].Name);
        if (fsmInt != null)
          fsmInt.Value = source.IntVariables[index].Value;
      }
      for (int index = 0; index < source.BoolVariables.Length; ++index)
      {
        FsmBool fsmBool = this.FindFsmBool(source.BoolVariables[index].Name);
        if (fsmBool != null)
          fsmBool.Value = source.BoolVariables[index].Value;
      }
      for (int index = 0; index < source.GameObjectVariables.Length; ++index)
      {
        FsmBool fsmBool = this.FindFsmBool(source.BoolVariables[index].Name);
        if (fsmBool != null)
          fsmBool.Value = source.BoolVariables[index].Value;
      }
      for (int index = 0; index < source.ColorVariables.Length; ++index)
      {
        FsmBool fsmBool = this.FindFsmBool(source.BoolVariables[index].Name);
        if (fsmBool != null)
          fsmBool.Value = source.BoolVariables[index].Value;
      }

As you can see, starting from BoolVariables, all other variables just have the bool part copy-pasted and unchanged.