Example #1
0
        public override void Init()
        {
            _renderer = Owner != null?Owner.GetComponent <Renderer>() : null;

            _matPropertyBlockInfo = GetMaterialPropertyBlockInfo(Owner != null ? Owner.GetInstanceID() : -1);

            base.Init();
        }
Example #2
0
        public override void Init()
        {
            _renderer = Owner.GetComponent <Renderer>();

            if (_materialPropertyBlocks == null)
            {
                _materialPropertyBlocks = new Dictionary <int, MaterialPropertyBlockInfo>();
            }

            _matPropertyBlockInfo = GetMaterialPropertyBlockInfo(Owner.GetInstanceID());

            base.Init();
        }
Example #3
0
        private static MaterialPropertyBlockInfo GetMaterialPropertyBlockInfo(int objInstanceId)
        {
            MaterialPropertyBlockInfo matPropertyBlockInfo = null;

            if (_materialPropertyBlocks.TryGetValue(objInstanceId, out matPropertyBlockInfo))
            {
                return(matPropertyBlockInfo);
            }

            matPropertyBlockInfo = new MaterialPropertyBlockInfo();

            _materialPropertyBlocks.Add(objInstanceId, matPropertyBlockInfo);

            return(matPropertyBlockInfo);
        }
Example #4
0
        private static MaterialPropertyBlockInfo GetMaterialPropertyBlockInfo(int objInstanceId)
        {
            if (_materialPropertyBlocks == null)
            {
                _materialPropertyBlocks = new Dictionary <int, MaterialPropertyBlockInfo>();
            }

            MaterialPropertyBlockInfo matPropertyBlockInfo = null;

            if (_materialPropertyBlocks.TryGetValue(objInstanceId, out matPropertyBlockInfo))
            {
                return(matPropertyBlockInfo);
            }

            matPropertyBlockInfo = new MaterialPropertyBlockInfo();

            _materialPropertyBlocks.Add(objInstanceId, matPropertyBlockInfo);

            return(matPropertyBlockInfo);
        }