public void HanldeDropEvent(MaterialProperty prop, ShaderProperty shaderProperty) { string[] paths = DragAndDrop.paths; if (AssetDatabase.GetMainAssetTypeAtPath(paths[0]) != typeof(Texture2DArray)) { Texture2DArray tex = Converter.PathsToTexture2DArray(paths); MaterialHelper.UpdateTargetsValue(prop, tex); if (shaderProperty.options.reference_property != null) { ShaderProperty p; if (ShaderEditor.currentlyDrawing.propertyDictionary.TryGetValue(shaderProperty.options.reference_property, out p)) { MaterialHelper.UpdateFloatValue(p.materialProperty, tex.depth); } } prop.textureValue = tex; } else { Texture2DArray tex = AssetDatabase.LoadAssetAtPath <Texture2DArray>(paths[0]); prop.textureValue = tex; if (shaderProperty.options.reference_property != null) { ShaderProperty p; if (ShaderEditor.currentlyDrawing.propertyDictionary.TryGetValue(shaderProperty.options.reference_property, out p)) { MaterialHelper.UpdateFloatValue(p.materialProperty, tex.depth); } } } }
private void UpdateFramesProperty(MaterialProperty prop, ShaderProperty shaderProperty, Texture2DArray tex) { if (framesProperty != null) { ShaderProperty p; if (ShaderEditor.active.propertyDictionary.TryGetValue(framesProperty, out p)) { MaterialHelper.UpdateFloatValue(p.materialProperty, tex.depth); } } else if (shaderProperty.options.reference_property != null) { ShaderProperty p; if (ShaderEditor.active.propertyDictionary.TryGetValue(shaderProperty.options.reference_property, out p)) { MaterialHelper.UpdateFloatValue(p.materialProperty, tex.depth); } } }