Jump to content

How can i add config UI for my mod building?


Recommended Posts

Hello Developers! I am currently making a mod with new building and reaching the final step. I want add a building option on the menu left, just like Automated Notifier:

Snipaste_2024-03-12_22-17-04.png.59805d6bca28dc3ced16f5e1696eb563.png

My building need a configurable string param ‘ProgramValue’, just like Name property in Automated Notifier. I tried to search for possible APIs in the game code, but found nothing.

I tried the following code, but the config UI did not appear on the side.

    [Serialize]
    private string programValue;
    public string ProgramValue
    {
      get
      {
        return programValue;
      }
      set
      {
        programValue = value;
      }
    }

    [MyCmpAdd]
    private CopyBuildingSettings copyBuildingSettings;

    private void OnCopySettings(object data)
    {
      FCPU component = ((GameObject)data).GetComponent<FCPU>();
      if (component != null)
        programValue = component.programValue;
    }

Config of My building:

Snipaste_2024-03-12_22-28-14.png.ce23c51a40e49a7a60d982089fb2518e.png

How can i add config UI for my building?

Thank you for your help!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...