コード例 #1
0
                protected override void UpdateProperties()
                {
                    int numRenderedInstances = GetNumRenderedInstances();

                    int index = 0;

                    for (int i = 0; i < numRenderedInstances; i++)
                    {
                        int             instanceIndex = GetRenderedInstanceIndex(i);
                        GPUAnimatorBase animator      = _instanceData[instanceIndex]._animator;
                        _mainAnimationFrames[index]       = animator.GetMainAnimationFrame();
                        _mainAnimationWeights[index]      = animator.GetMainAnimationWeight();
                        _backgroundAnimationFrames[index] = animator.GetBackgroundAnimationFrame();

                        index++;
                    }

                    _propertyBlock.SetFloatArray("_mainAnimationFrame", _mainAnimationFrames);
                    _propertyBlock.SetFloatArray("_mainAnimationWeight", _mainAnimationWeights);
                    _propertyBlock.SetFloatArray("_backgroundAnimationFrame", _backgroundAnimationFrames);
                }
コード例 #2
0
 public GPUAnimatedMeshInstance(GameObject instance, object extraData = null)
 {
     _gameObject = instance;
     _animator   = GameObjectUtils.GetComponent <GPUAnimatorBase>(instance, true);
     _extraData  = extraData;
 }