Search Unity

Bug getting error Ambiguity between 'IntSubtract.intVariable' and 'IntSubtract.intVariable for 9 scripts

Discussion in 'Scripting' started by dantdmsfan, Mar 26, 2023.

  1. dantdmsfan

    dantdmsfan

    Joined:
    Jan 25, 2020
    Posts:
    5
    using UnityEngine;

    namespace HutongGames.PlayMaker.Actions
    {
    [ActionCategory(ActionCategory.Math)]
    [Tooltip("Subtracts a value to an Integer Variable.")]
    public class IntSubtract : FsmStateAction
    {
    [RequiredField]
    [UIHint(UIHint.Variable)]
    [Tooltip("The int variable to subtract from.")]
    public FsmInt intVariable;

    [RequiredField]
    [Tooltip("Value to subtract from the int variable.")]
    public FsmInt subtract;

    [Tooltip("Repeat every frame while the state is active.")]
    public bool everyFrame;

    [Tooltip("Used with Every Frame. Subtracts the value over one second to make the operation frame rate independent.")]
    public bool perSecond;

    float _acc = 0f;

    public override void Reset()
    {
    intVariable = null;
    subtract = null;
    everyFrame = false;
    perSecond = false;
    }

    public override void OnEnter()
    {
    doSubtract();

    if (!everyFrame)
    Finish();
    }

    public override void OnUpdate()
    {
    doSubtract();

    }

    void doSubtract()
    {
    if (perSecond)
    {
    int _absSub = Mathf.Abs(subtract.Value);
    _acc += ( _absSub* Time.deltaTime);
    if (_acc>=_absSub)
    {
    _acc = 0f;
    intVariable.Value -= subtract.Value;
    }
    }else{
    intVariable.Value -= subtract.Value;
    }
    }
    }
    }
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,497
    Please edit to use code-tags. If you have errors, post the full error which also includes line numbers (etc) otherwise you're asking devs to figure out what the compiler knows.

    I would suggest though that you ask on the Playmaker forum instead because this is a 3rd-party product.

    Thanks.
     
    Bunny83 likes this.
  3. dantdmsfan

    dantdmsfan

    Joined:
    Jan 25, 2020
    Posts:
    5
    how? im sorry but im new and dont know what code-tags are
     
  4. chemicalcrux

    chemicalcrux

    Joined:
    Mar 16, 2017
    Posts:
    720
    These things here:

    upload_2023-3-26_8-15-17.png

    The first one opens a dialog to paste code into.

    Code (CSharp):
    1. int x = 1337;
    2. return 451;
    The second one is for
    inline code, like this
    .
     
    MelvMay likes this.
  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,497
    Try clicking on the link I provided.
     
    Bunny83 likes this.