Search Unity

Custom GUI for Special Data Types

Discussion in 'Immediate Mode GUI (IMGUI)' started by hedkace, Jul 20, 2016.

  1. hedkace

    hedkace

    Joined:
    Jun 29, 2015
    Posts:
    3
    I've got some Javascript stuff (html, css and javascript) I wanted to use inside of unity. I know you can pull up the asset store and essentially browser that site. That browser seems to be able to pass info back to editor about what you are choosing to download/import/account info, ect...

    I want to be able to make a custom tab or window that allows to me to access an offline webpage (for lack of a better term) and get stuff back from it and make changes to c# files.

    Basically the Javascript (webpage) outputs XML and I want to use the XML to build c# files and I want to be able to use the gui of the webpage.

    Can I do this with a custom editor (and how)? I know it's a large, long and complicated thing with multiple parts to figure out, but if you could just link me to some relevant info, I will of course try to work through it myself from that. I'm just asking for direction from someone more knowledgeable than myself.
     
  2. IzzySofty

    IzzySofty

    Joined:
    Jul 4, 2016
    Posts:
    19
  3. WazzaM

    WazzaM

    Joined:
    Jan 10, 2015
    Posts:
    11
    Hi @hedkace

    The issue with doing this sort of thing in a browser is the web security models don't let you manipulate files on the local filesystem. You could try integrating an electron based interface and execute in that but it be difficult to glue into Unity.

    Why not just write an EditorWindow in C#? https://docs.unity3d.com/ScriptReference/EditorWindow.html
    Also you can do rich text in the window if you create a GUIStyle https://docs.unity3d.com/ScriptReference/GUIStyle-richText.html

    On the XML, I'm curious are you trying to generate XML project build files - MSBuild style (mono does support this with known limitations). If you generate C# in the Assets folder, Unity will compile it automatically so this doesn't seem necessary - or are you trying to generate plugins??

    Further thought, one great C# feature for generated code is partial classes so a dev can write part of the class and not be overwritten by generated parts - just wanted to call that out for your consideration.