public static UT_PolyBaseFactory GetInstance()
        {
            if (s_Instance == null)
            {
                s_Instance = new UT_PolyBaseFactory();
            }

            return s_Instance;
        }
        public UT_HugeCompoundClass()
        {
            int initSeed  = m_ValueSeed;
            int valueSeed = m_ValueSeed;

            // ints
            for (int i = 0; i < m_TestInts.Length; ++i)
            {
                m_TestInts[i] = valueSeed++;
            }

            // floats
            for (int i = 0; i < m_TestFloats.Length; ++i)
            {
                m_TestFloats[i] = (valueSeed++) * 0.31f;
            }

            // double
            for (int i = 0; i < m_TestDoubles.Length; ++i)
            {
                m_TestDoubles[i] = (valueSeed++) * 0.13;
            }

            // string
            for (int i = 0; i < m_TestStrings.Length; ++i)
            {
                int curSeed = valueSeed++;

                if (curSeed % 3 == 0)
                {
                    m_TestStrings[i] = (curSeed) + "äüösChina";

                    for (int j = 0; j < 10; ++j)
                    {
                        m_TestStrings[i] += GetRandomUnicodeChar(curSeed++);
                    }
                }
                else if (curSeed % 3 == 1)
                {
                    m_TestStrings[i] = "";
                }
                else
                {
                    m_TestStrings[i] = null;
                }
            }

            // bool
            for (int i = 0; i < m_TestBools.Length; ++i)
            {
                m_TestBools[i] = (valueSeed++) % 2 == 0;
            }

            // char
            for (int i = 0; i < m_TestChars.Length; ++i)
            {
                m_TestChars[i] = GetRandomUnicodeChar(valueSeed++);
            }

            // enum
            for (int i = 0; i < m_TestEnums.Length; ++i)
            {
                m_TestEnums[i] = (UT_TestEnum) ((valueSeed++) % (int)UT_TestEnum.Count);
            }

            ///////////////////////////////////////////////////////////////////////////

            // simple serializables
            for (int i = 0; i < m_SimpleSerializables.Length; ++i)
            {
                m_SimpleSerializables[i] = ((initSeed + i) % 2 == 0) ? null : new UT_SimpleSerializable(valueSeed++);
            }

            // Sub 1
            for (int i = 0; i < m_PolySub1s.Length; ++i)
            {
                m_PolySub1s[i] = ((initSeed + i) % 2 == 0) ? null : new UT_PolySub1(valueSeed++);
            }

            // Sub 2
            for (int i = 0; i < m_PolySub2s.Length; ++i)
            {
                m_PolySub2s[i] = ((initSeed + i) % 2 == 0) ? null : new UT_PolySub2(valueSeed++, valueSeed++);
            }

            // Mixed
            for (int i = 0; i < m_PolyBases.Length; ++i)
            {
                m_PolyBases[i] = UT_PolyBaseFactory.GetRandomPolyBase(initSeed + i, ref valueSeed);
            }

            ///////////////////////////////////////////////////////////////////////////

            // Lists
            m_ListInt					= new List<int>						{ valueSeed++, valueSeed++, valueSeed++ };
            m_ListSimpleSerializables	= new List<UT_SimpleSerializable>	{ new UT_SimpleSerializable(valueSeed++), new UT_SimpleSerializable(valueSeed++)};
            m_ListPolyBase				= new List<UT_IPolyBase>			{ UT_PolyBaseFactory.GetRandomPolyBase(initSeed, ref valueSeed), UT_PolyBaseFactory.GetRandomPolyBase(initSeed + 1, ref valueSeed), UT_PolyBaseFactory.GetRandomPolyBase(initSeed + 1, ref valueSeed) };
            m_ListPolySub				= new List<UT_PolySub2>				{ new UT_PolySub2(valueSeed++, valueSeed++), new UT_PolySub2(valueSeed++, valueSeed++) };
        }
        ///////////////////////////////////////////////////////////////////////////
        public void Serialize(Serializer serializer)
        {
            bool foundStructureSeed = serializer.Serialize("structureSeed", ref m_StructureSeed, -1);
            if (!foundStructureSeed)
            {
                Debug.LogError("Did not found [structureSeed]");
            }

            m_StructureRand = new System.Random(m_StructureSeed);
            m_ManualStructureDepth = 0;

            // ints
            AddRandomTreeStructure(serializer);
            bool foundAllTags = serializer.Serialize("testInt01", ref m_TestInts[0], -1);
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testInt01", ref m_TestInts[1], -1);
            AddRandomTreeStructure(serializer);

            // floats
             	AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testFoat01", ref m_TestFloats[0], -1);
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testFoat01", ref m_TestFloats[1], -1);
            AddRandomTreeStructure(serializer);

            // double
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testDouble01", ref m_TestDoubles[0], -1.0);
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testDouble01", ref m_TestDoubles[1], -1.0);
            AddRandomTreeStructure(serializer);

            // string
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testString01", ref m_TestStrings[0], "");
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testString01", ref m_TestStrings[1], "");
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testString01", ref m_TestStrings[2], "");
            AddRandomTreeStructure(serializer);

            // bool
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testBool01", ref m_TestBools[0], true);
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testBool01", ref m_TestBools[1], false);
            AddRandomTreeStructure(serializer);

            // char
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testchar01", ref m_TestChars[0], 'a');
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testchar01", ref m_TestChars[1], 'b');
            AddRandomTreeStructure(serializer);

            // enum
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("enum1", ref m_TestEnums[0], UT_TestEnum.Count);
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("enum2", ref m_TestEnums[1], UT_TestEnum.Count);
            AddRandomTreeStructure(serializer);

            ///////////////////////////////////////////////////////////////////////////

            // simple serializables
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testSer0", ref m_SimpleSerializables[0],	false);
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testSer1", ref m_SimpleSerializables[1],	false);
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testSer2", ref m_SimpleSerializables[2],	false);
            AddRandomTreeStructure(serializer);

            // Sub 1
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testSer", ref m_PolySub1s[0],	UT_PolyBaseFactory.GetInstance());
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testSer", ref m_PolySub1s[1],	UT_PolyBaseFactory.GetInstance());
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testSer", ref m_PolySub1s[2],	UT_PolyBaseFactory.GetInstance());
            AddRandomTreeStructure(serializer);

            // Sub 2
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testSer", ref m_PolySub2s[0],	UT_PolyBaseFactory.GetInstance());
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testSer", ref m_PolySub2s[1],	UT_PolyBaseFactory.GetInstance());
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testSer", ref m_PolySub2s[2],	UT_PolyBaseFactory.GetInstance());
            AddRandomTreeStructure(serializer);

            // Mixed
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testSer", ref m_PolyBases[0],	UT_PolyBaseFactory.GetInstance());
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testSer", ref m_PolyBases[1],	UT_PolyBaseFactory.GetInstance());
            AddRandomTreeStructure(serializer);
            foundAllTags &= serializer.Serialize("testSer", ref m_PolyBases[2],	UT_PolyBaseFactory.GetInstance());
            AddRandomTreeStructure(serializer);

            ///////////////////////////////////////////////////////////////////////////

            // Lists
            foundAllTags &= serializer.Serialize("laLista", ref m_ListIntNull);
            foundAllTags &= serializer.Serialize("laLista", ref m_ListInt);
            foundAllTags &= serializer.Serialize("laLista", ref m_ListSimpleSerializablesNull,	false);
            foundAllTags &= serializer.Serialize("laLista", ref m_ListSimpleSerializables,		false);
            foundAllTags &= serializer.Serialize("laLista", ref m_ListPolyBase,					UT_PolyBaseFactory.GetInstance());
            foundAllTags &= serializer.Serialize("laLista", ref m_ListPolySub,					UT_PolyBaseFactory.GetInstance());

            if (!foundAllTags)
            {
                Debug.LogError("Did not find all tags :(");
            }

            FinalizeManualStructureDepths(serializer);
        }