Chess PGN

How to load PGN text file

The PGN text folder is located at path Resources/PGN/TextFiles, any newly imported PGN text files have to be in this location.

To be able to select a new imported PGN text file :

1) the exact file name has to be registed in ChessPGNGameFilesName scriptable object located in Resources/ScriptableObjects/ChessPGN folder.

2) The PGN text file selection dropdown will automatic refer to the file name in the list of ChessPGNGameFilesName scriptable object according to index of itself. Without counting in Custom dropdown option, add as many dropdown options as the number of text file name in the scriptable object list, the dropdown name does not matters at all.

How to add new PGN header record type for PGN file text format?

The example format for PGN text file

Step 1

In ChessPGNRecord.cs file located at path Scripts/Mechanism/Structs, add new property to ChessPGNRecord struct

Step 2

Note that all of the values contained in ChessPGNType enum matches the parameters of PGN text file as circled in red in below image. Is it possible to add extra parameters to PGN text file by first adding the parameter as value to ChessPGNType enum, then move to next step.

Step 3

In Helper.cs file located at path Scripts/Mechanism/Core, in the ConvertToPGNRecords() function, add an else if statement for the new property added from 2nd Steps like the example image below.

Last updated