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!

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...