void OnEnable()
        {
            drawCallTarget            = target as DrawCallMinimizer;
            destroyOriginalGameObject = serializedObject.FindProperty("destroyOriginalGameObject");
            textureAtlasProperties    = serializedObject.FindProperty("_textureAtlasProperties");
            skipAtlasingTextures      = serializedObject.FindProperty("skipTextureAtlasing");
            propertiesToLookFor       = drawCallTarget.textureAtlasProperties;

            if (propertiesToLookFor == null)
            {
                propertiesToLookFor = new DrawCallMinimizerInfo();
            }
            IEnumerable <string> propertiesList = ShaderPropertyUtility.GetUniqueShaderPropertyNames(drawCallTarget.GetComponentsInChildren <Renderer>().Select(X => X.sharedMaterial).Distinct());

            //here we clear out properties that are no longer referenced
            IList <ShaderProperties> activeProperties = propertiesToLookFor.shaderPropertiesToLookFor.Where(x => propertiesList.Contains(x.propertyName)).ToList();

            //then we figure out which properties still need to be added to the list
            propertiesList = propertiesList.Where(x => !activeProperties.Select(property => property.propertyName).Contains(x));

            foreach (string s in propertiesList)
            {
                activeProperties.Add(new ShaderProperties(false, s));
            }

            propertiesToLookFor.shaderPropertiesToLookFor = activeProperties;
            serializedObject.ApplyModifiedProperties();
            ReimportNonReadonly();
            //Reimport anything that is needed
        }
        void OnEnable()
        {
            drawCallTarget = target as DrawCallMinimizer;
            destroyOriginalGameObject = serializedObject.FindProperty("destroyOriginalGameObject");
            textureAtlasProperties = serializedObject.FindProperty("_textureAtlasProperties");
            skipAtlasingTextures = serializedObject.FindProperty("skipTextureAtlasing");
            propertiesToLookFor = drawCallTarget.textureAtlasProperties;

            if (propertiesToLookFor == null) {
                propertiesToLookFor = new DrawCallMinimizerInfo();

            }
            IEnumerable<string> propertiesList = ShaderPropertyUtility.GetUniqueShaderPropertyNames(drawCallTarget.GetComponentsInChildren<Renderer>().Select(X => X.sharedMaterial).Distinct());

            //here we clear out properties that are no longer referenced
            IList<ShaderProperties> activeProperties = propertiesToLookFor.shaderPropertiesToLookFor.Where(x => propertiesList.Contains(x.propertyName)).ToList();

            //then we figure out which properties still need to be added to the list
            propertiesList = propertiesList.Where(x => !activeProperties.Select(property => property.propertyName).Contains(x));

            foreach (string s in propertiesList) {
                activeProperties.Add(new ShaderProperties(false, s));
            }

            propertiesToLookFor.shaderPropertiesToLookFor = activeProperties;
            serializedObject.ApplyModifiedProperties();
            ReimportNonReadonly();
            //Reimport anything that is needed
        }
 void OnEnable()
 {
     drawCallTarget            = target as DrawCallMinimizer;
     destroyOriginalGameObject = serializedObject.FindProperty("destroyOriginalGameObject");
     textureAtlasProperties    = serializedObject.FindProperty("_textureAtlasProperties");
 }
 void OnEnable()
 {
     drawCallTarget = target as DrawCallMinimizer;
     destroyOriginalGameObject = serializedObject.FindProperty("destroyOriginalGameObject");
     textureAtlasProperties = serializedObject.FindProperty("_textureAtlasProperties");
 }