Passing value to custom additional code

I’m using an C# component someone else wrote, and there’s a varible that needs to be set to match my current ip.
I’ll annoying to change this value because every time i have to click into the component to change it.
this value is under Custom additional code and i’m having trouble creating an input for this value

This is the C# script


the one that I need to set is public string hostIP = "10.97.80.205"
So i tried something like this

but it doesn’t work

just wondering what’s the proper way of passing an input value to hostIP?

If you declare ip as static you can do it just as you have it, but it would be appropriate to pass that value on to the constructor.

public class MotiveDirect{
  ...
  public MotiveDirect(string Hip){
    hostIP = Hip;
  }
}

var motive = new MotiveDirect(hip);

In C#, the equals symbol is an assignment operator, it doesn’t define a relationship. So the value in ip is assigned to hostIP once and only once. If ip changes later, it will not affect hostIP.

Either store the ip string as a single variable accessible from both the RunScript method and the class, or assign it to the class directly.

So I tried what @Dani_Abalde suggested, and i’m getting errors, what am i doing wrong?


This is what i Have

@DavidRutten this is probably a stupid question, but how would I assign it to the class directly?

Returns the field hostIP within the class.

public class MotiveDirect{
  ...
  public string hostIP;
  public MotiveDirect(string Hip){
    hostIP = Hip;
  }
}