private void RecreateInjectors() { Material material; if (Application.isEditor) { material = GetComponent <MeshRenderer>().sharedMaterial; } else { material = GetComponent <MeshRenderer>().material; } EditorUpdate2GO editorUpdate2Go = FindObjectOfType <EditorUpdate2GO>(); Func <bool> isEnabledFunc = () => { if (this == null) { Debug.Log("W865 This Component was in destroyed object, i repaired problem"); return(false); } return(enabled); }; foreach (var type in ShaderBufferTypes) { var shaderBuffer = RetriveShaderBuffer(type); _injectors.Add(new CachedShaderBufferInjector(shaderBuffer, type.Details().StrideInFloats, isEnabledFunc, type.Details().InShaderBufferName, AutomaticReset, this.name, editorUpdate2Go, material)); } }
protected ShaderBufferInjector(bool automaticReset, string bufferName, string name, EditorUpdate2GO editorUpdate2Go, Material material) { _automaticReset = automaticReset; _bufferName = bufferName; _name = name; _editorUpdate2Go = editorUpdate2Go; _material = material; }
public CachedShaderBufferInjector(ShaderBufferSE shaderBuffer, int strideInFloats, Func <bool> isEnabledFunc, string bufferName, bool automaticReset, string objectName, EditorUpdate2GO editorUpdate2Go, Material material) : base(automaticReset, bufferName, objectName, editorUpdate2Go, material) { _shaderBuffer = shaderBuffer; _strideInFloats = strideInFloats; _isEnabledFunc = isEnabledFunc; UpdateVariables(); }