Search Unity

Custom Editor to create GO and fill in text fields from CSV file

Discussion in 'Editor & General Support' started by artofmining, Oct 22, 2020.

  1. artofmining

    artofmining

    Joined:
    May 1, 2016
    Posts:
    83
    UPDATE: Afterthought, Maybe I'll do it at run time instead, that way I can manage memory as the GO's can be destroyed once used.

    Hi,
    Does anyone have a custom editor script example to do the following:

    I have a quiz system that works by having a parent GO(Question Manager) and multiple child objects under the parent GO(Question Manager). Each child GO(Question Creator) has a script with number of string variables: Question type, Question, AnswerA,AnswerB .. ,CorrectAnswer.

    The Question Manager iterates through the child objects and reads the current childs variable (for each) and populates button text on a relative UI element.
    All this works fine! it automatically sets up the UI type and populates data for current question

    ====================
    Requirement: Avoid the labour of manually adding Question GO's and Populate from an external list instead.

    My next ambitous step is to be able to import a CSV of Q&A's that can read line by line and generate a child GO called QuestionCreator. It then needs to add the Question Creator Script and populate string variables that are read from the current line in the CSV field.

    I have no knowledge of custom editors and would really appreciate a working exmaple to get me started!

    Any help much appreciated!

    Cheers
    Archy
     
    Last edited: Oct 22, 2020