Skip to content

Latest commit

 

History

History
47 lines (24 loc) · 1.76 KB

Guide1E2_EN.md

File metadata and controls

47 lines (24 loc) · 1.76 KB

Using nested types

We Assume You've Finished

Finished the guidance Reading data in Unity which fulfilled in a new xlsx file

Guiding in Progress

  1. Create a new sheet named "Parent" in "StudentsData.xlsx", and fill the sheet with data as the following image.

    Parent sheet in StudentsData.xlsx

  2. Insert two columns in "Student" sheet, with the field name "father" and "mother", with their types both Parent. Fill the two columns with the key corresponding to the parent_id in "Parent" sheet.

    parent columns in Student sheet

  3. Back to Unity and execute "Process Excel" again.

    Configuration window, focus on "Process Excel"

  4. Modify TestExcelToSO.cs to test parents data.

    TestExcelToSO.cs, focus on changed

  5. Run the code and check Console window for result.

    Console output focus on changed

  6. Hide method "GetParent"

    Currently, the method StudentsData.GetParent is a public method.

    StudentsData.cs GetParent define

    The method GetParent can be successfully invoked.

    TestExcelToSO.cs GetParent

    Open "StudentsData.xlsx" and rename the sheet "Parent" into ".Parent". And then go back to Unity and execute "Process Excel" again.

    rename Parent into .Parent

    An compile error occurs ! "GetParent" method is invalid now.

    TestExcelToSO.cs GetParent is invalid

    After resolving the compile error, DO NOT forget to re-execute "Process Excel" to make the data asset file accurate.