Search Unity

Unity Editor Scripting with XML

Discussion in 'Scripting' started by SD2020_, Sep 26, 2017.

  1. SD2020_

    SD2020_

    Joined:
    Nov 3, 2015
    Posts:
    107
    Hi there,

    I am trying to read a XML File I have created but not sure how to, I am looking to read it inside my editor script rather then MonoBehaviour.

    I am new to XML so i'm not even sure if I have written the script right.

    Here is my XML::
    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <Hierarchy_IconsDB>
    3.     <Settings>
    4.         <Canvas_Settings>
    5.           <Canvas_UI>TRUE</Canvas_UI>
    6.         </Canvas_Settings>
    7.     </Settings>
    8. </Hierarchy_IconsDB>
    9.  
    I have this XML file located in a resources folder.

    Be very handy if someone can help me return the Canvas_UI data.


    Thank you very much!
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    What've you tried to do?

    C# has a built-in XML reader class, which you should be able to use.
     
    SD2020_ likes this.
  3. SD2020_

    SD2020_

    Joined:
    Nov 3, 2015
    Posts:
    107
    I understand that but I am still new to XML and was wondering if someone would be able to give me and example to read and write to that then I can continue off that.