void Init()
        {
            if (initialized)
            {
                return;
            }

            initialized = true;

            int count = Lines.Length;

            defSortingOrder = new int[count];
            for (int i = 0; i < count; ++i)
            {
                LineRenderer   lr   = Lines[i];
                SortingOrder3D sort = lr.GetComponent <SortingOrder3D>();
                if (sort != null)
                {
                    defSortingOrder[i] = sort.SortingOrder;
                }
                else
                {
                    defSortingOrder[i] = lr.GetComponent <Renderer>().sortingOrder;
                }
            }
        }
Example #2
0
        void Init()
        {
            if (initialized)
            {
                return;
            }

            initialized = true;

            Trails = this.GetComponentsInChildren <TrailRenderer>(true);
            int count = Trails.Length;

            defStartWidths  = new float[count];
            defEndWidths    = new float[count];
            defSortingOrder = new int[count];
            for (int i = 0; i < count; ++i)
            {
                TrailRenderer tr = Trails[i];
                if (Time < tr.time)
                {
                    Time = tr.time;
                }
                defStartWidths[i] = tr.startWidth;
                defEndWidths[i]   = tr.endWidth;
                SortingOrder3D sort = tr.GetComponent <SortingOrder3D>();
                if (sort != null)
                {
                    defSortingOrder[i] = sort.SortingOrder;
                }
                else
                {
                    defSortingOrder[i] = tr.GetComponent <Renderer>().sortingOrder;
                }
            }
        }