Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Nested dynamic array types. Help!

Discussion in 'Project Tiny' started by RobertoPelonara, Mar 21, 2019.

  1. RobertoPelonara

    RobertoPelonara

    Joined:
    Mar 2, 2015
    Posts:
    9
    Hi devs,

    I have a question related my data structure:

    I have the following structs:




    But I have problems with the "Alternatives" array. Here's the error:
    "Cannot export type UTiny.DynamicArray`1<game.Question> because it has nested dynamic array types!"
     
  2. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748
    You may restructure your data to avoid this. For now you have something like this:

    Code (CSharp):
    1. public class Question {
    2.    public string text;
    3.    public Question[] alternatives;
    4. }
    It is possible to restructure without type nesting:

    Code (CSharp):
    1. public class QuestionWithAlternatives {
    2.    public Question main;
    3.    public Question[] alternatives;
    4. }
     
    Deleted User likes this.
  3. RobertoPelonara

    RobertoPelonara

    Joined:
    Mar 2, 2015
    Posts:
    9
    Worked like charm! Thank you
     
  4. Deleted User

    Deleted User

    Guest

    Wow, this solution will be very useful for me too.
    Thanks @palex-nx