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

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

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

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

            _matPropertyBlockInfo = GetMaterialPropertyBlockInfo(Owner.GetInstanceID());

            base.Init();
        }
示例#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);
        }
示例#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);
        }