void UpdateTransformIndex()
        {
            if (!m_Dirty)
            {
                return;
            }
            m_Dirty = false;
            Profiler.BeginSample("UpdateTransformIndex");
            NativeArrayHelpers.ResizeIfNeeded(ref m_TransformMatrix, m_Transform.Length);
            if (!m_TransformAccessArray.isCreated)
            {
                TransformAccessArray.Allocate(m_Transform.Length, -1, out m_TransformAccessArray);
            }
            else if (m_TransformAccessArray.capacity != m_Transform.Length)
            {
                m_TransformAccessArray.capacity = m_Transform.Length;
            }
            m_TransformAccessArray.SetTransforms(m_Transform);

            for (int i = 0; i < m_Transform.Length; ++i)
            {
                if (m_Transform[i] != null)
                {
                    var instanceId    = m_Transform[i].GetInstanceID();
                    var transformData = m_TransformData[instanceId];
                    transformData.transformIndex = i;
                    m_TransformData[instanceId]  = transformData;
                }
            }
            Profiler.EndSample();
        }
Beispiel #2
0
    private void CreateTransformArray()
    {
        if (IsReady() && _Instances != null && _Instances.Length > 0)
        {
            TransformAccessArray.Allocate(
                _Instances.Length,
                UtilFuncs.BATCH_SIZE,
                out _Transforms
                );

            for (int index = 0; index < _Instances.Length; index++)
            {
                _Transforms.Add(_Instances[index].GetComponent <Transform>());
            }
        }
    }