Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

PartsProvider: Difference between revisions

From Kerbal Space Program 2 Modding Wiki
Spacewarp>Munix
m Added category
Spacewarp>Munix
No edit summary
Line 1: Line 1:
== KSP.Game.'''PartProvider''' ==
[[Category:Parts modding]]
[[Category:Game systems]]
== KSP.Game.PartProvider ==
This class is the main provider for anything related to parts definitions and data.
This class is the main provider for anything related to parts definitions and data.


Line 12: Line 14:
* You can either use '''[https://docs.unity3d.com/ScriptReference/JsonUtility.ToJson.html JsonUtility]''' or '''[https://www.newtonsoft.com/json/help/html/SerializeObject.htm newtonsoft's Json.Net]''' to get your '''rawJson'''.
* You can either use '''[https://docs.unity3d.com/ScriptReference/JsonUtility.ToJson.html JsonUtility]''' or '''[https://www.newtonsoft.com/json/help/html/SerializeObject.htm newtonsoft's Json.Net]''' to get your '''rawJson'''.
* You can access it via '''GameManager.Instance.Game.Parts'''.
* You can access it via '''GameManager.Instance.Game.Parts'''.
[[Category:Parts modding]]

Revision as of 01:11, 3 August 2023

KSP.Game.PartProvider

This class is the main provider for anything related to parts definitions and data.

AddPartData(KSP.Sim.Definitions.PartCore jsonData, System.string rawJson)

This method is used to add parts to the PartProvider. It asks for a PartCore and a raw json (from the same part core provided).

  • jsonData - This argument requires a part core which is a class defining almost all the part's data. Including all modules.
  • rawJson - This argument requires a json equivalent to the jsonData provided. It should match exactly what you provide on the first argument.

Tips and Tricks: