public override void Init() { _renderer = Owner != null?Owner.GetComponent <Renderer>() : null; _matPropertyBlockInfo = GetMaterialPropertyBlockInfo(Owner != null ? Owner.GetInstanceID() : -1); base.Init(); }
public override void Init() { _renderer = Owner.GetComponent <Renderer>(); if (_materialPropertyBlocks == null) { _materialPropertyBlocks = new Dictionary <int, MaterialPropertyBlockInfo>(); } _matPropertyBlockInfo = GetMaterialPropertyBlockInfo(Owner.GetInstanceID()); base.Init(); }
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); }
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); }