void OnPostprocessModel(GameObject gameObject)
    {
        if (!assetPath.Contains(_brandingPostfix + "Assets"))
        {
            return;
        }

        // Remove and disable auto generated materials, assign the one from the xml file
        SetupMaterial(gameObject);
//		SetupPrefab(gameObject, newObjMat);

        // Recalculate the tangents using UV2
        ZGONMeshBoolProperty objTangentFromUv2 = (ZGONMeshBoolProperty)SearchMeshProps(ZGONAssetProperties.objTangentFromUv2Name);

        if (objTangentFromUv2.Value)
        {
            try
            {
                gameObject.GetComponent <MeshFilter>().sharedMesh = CalcTangentsFromUV2(gameObject.GetComponent <MeshFilter>().sharedMesh);
            }
            catch (System.Exception)
            {
                Debug.LogError(_assetName + " : Has invalid UV2 coordinates, cannot recalculate tangents.");
            }
        }
    }
    void ParseXMLData()
    {
        if (_meshsetName != _lastMeshsetName)
        {
            _meshsetXml.Load(_meshsetRootDir + "/" + _meshsetName + ".xml");
            _lastMeshsetName = _meshsetName;
        }

        // Find the imported mesh in the XML file
        XmlNodeList nodeList = _meshsetXml.GetElementsByTagName(_assetName);
        IEnumerator enumNodeList = nodeList[0].GetEnumerator();

        while (enumNodeList.MoveNext())
        {
            XmlNode currentNode = (XmlNode) enumNodeList.Current;
            XmlNode attribTypeNode = currentNode.Attributes.GetNamedItem("type");

            string typeValue = attribTypeNode.Value;

            if (typeValue == "string")
            {
                ZGONMeshStringProperty meshProp = new ZGONMeshStringProperty();
                meshProp.Name = currentNode.Name;
                meshProp.Value = currentNode.Attributes.GetNamedItem("value").Value;
                _meshProps.Add(meshProp);
            }
            else if (typeValue == "bool")
            {
                ZGONMeshBoolProperty meshProp = new ZGONMeshBoolProperty();
                meshProp.Name = currentNode.Name;
                meshProp.Value = Convert.ToBoolean(currentNode.Attributes.GetNamedItem("value").Value);
                _meshProps.Add(meshProp);
            }
            else if (typeValue == "float")
            {
                ZGONMeshFloatProperty meshProp = new ZGONMeshFloatProperty();
                meshProp.Name = currentNode.Name;
                meshProp.Value = Convert.ToSingle(currentNode.Attributes.GetNamedItem("value").Value);
                _meshProps.Add(meshProp);
            }
            else if (typeValue == "color")
            {
                ZGONMeshColorProperty meshProp = new ZGONMeshColorProperty();
                meshProp.Name = currentNode.Name;
                Color colorValue = new Color();
                colorValue.r = Convert.ToSingle(currentNode.Attributes.GetNamedItem("r").Value);
                colorValue.g = Convert.ToSingle(currentNode.Attributes.GetNamedItem("g").Value);
                colorValue.b = Convert.ToSingle(currentNode.Attributes.GetNamedItem("b").Value);
                meshProp.Value = colorValue;
                _meshProps.Add(meshProp);
            }
            else if (typeValue == "texture")
            {
                ZGONMeshTextureProperty meshProp = new ZGONMeshTextureProperty();
                meshProp.Name = currentNode.Name;
                meshProp.Parameter = currentNode.Attributes.GetNamedItem("parameter").Value;

                string texPath = null;
                List<string> foundTextures = new List<string>();
                string[] fileExtensions = new string[3] { "*.psd", "*.png", "*.tga" };
                FindFilesInProject(fileExtensions, _meshsetRootDir, ref foundTextures);
                FindFilesInProject(fileExtensions, _sharedDir, ref foundTextures);
                FindFilesInProject(fileExtensions, _meshsetSharedDir, ref foundTextures);

                for (int i = 0; i < foundTextures.Count; i++)
                {
                    foundTextures[i] = CleanFilePathString(foundTextures[i]);
                }

                foreach (string foundTex in foundTextures)
                {
                    string texName = currentNode.Attributes.GetNamedItem("value").Value;

                    if (texName == string.Empty)
                    {
                        texPath = "none";
                        continue;
                    }

                    if (foundTex.Contains(texName))
                        texPath = foundTex;
                }

                if (texPath != null)
                {
                    meshProp.Value = (Texture)AssetDatabase.LoadAssetAtPath(texPath, typeof(Texture));
                    _meshProps.Add(meshProp);
                }
                else if (texPath == "none")
                    Debug.Log(meshProp.Parameter + " : Has an empty texure reference.");
                else
                    Debug.LogError("Did not find texture in project.");
            }
            else if (typeValue == "shader")
            {
                ZGONMeshShaderProperty meshProp = new ZGONMeshShaderProperty();
                meshProp.Name = currentNode.Name;
                meshProp.Value = currentNode.Attributes.GetNamedItem("value").Value;
                _meshProps.Add(meshProp);
            }
        }
    }
    void ParseXMLData()
    {
        if (_meshsetName != _lastMeshsetName)
        {
            _meshsetXml.Load(_meshsetRootDir + "/" + _meshsetName + ".xml");
            _lastMeshsetName = _meshsetName;
        }

        // Find the imported mesh in the XML file
        XmlNodeList nodeList     = _meshsetXml.GetElementsByTagName(_assetName);
        IEnumerator enumNodeList = nodeList[0].GetEnumerator();

        while (enumNodeList.MoveNext())
        {
            XmlNode currentNode    = (XmlNode)enumNodeList.Current;
            XmlNode attribTypeNode = currentNode.Attributes.GetNamedItem("type");

            string typeValue = attribTypeNode.Value;

            if (typeValue == "string")
            {
                ZGONMeshStringProperty meshProp = new ZGONMeshStringProperty();
                meshProp.Name  = currentNode.Name;
                meshProp.Value = currentNode.Attributes.GetNamedItem("value").Value;
                _meshProps.Add(meshProp);
            }
            else if (typeValue == "bool")
            {
                ZGONMeshBoolProperty meshProp = new ZGONMeshBoolProperty();
                meshProp.Name  = currentNode.Name;
                meshProp.Value = Convert.ToBoolean(currentNode.Attributes.GetNamedItem("value").Value);
                _meshProps.Add(meshProp);
            }
            else if (typeValue == "float")
            {
                ZGONMeshFloatProperty meshProp = new ZGONMeshFloatProperty();
                meshProp.Name  = currentNode.Name;
                meshProp.Value = Convert.ToSingle(currentNode.Attributes.GetNamedItem("value").Value);
                _meshProps.Add(meshProp);
            }
            else if (typeValue == "color")
            {
                ZGONMeshColorProperty meshProp = new ZGONMeshColorProperty();
                meshProp.Name = currentNode.Name;
                Color colorValue = new Color();
                colorValue.r   = Convert.ToSingle(currentNode.Attributes.GetNamedItem("r").Value);
                colorValue.g   = Convert.ToSingle(currentNode.Attributes.GetNamedItem("g").Value);
                colorValue.b   = Convert.ToSingle(currentNode.Attributes.GetNamedItem("b").Value);
                meshProp.Value = colorValue;
                _meshProps.Add(meshProp);
            }
            else if (typeValue == "texture")
            {
                ZGONMeshTextureProperty meshProp = new ZGONMeshTextureProperty();
                meshProp.Name      = currentNode.Name;
                meshProp.Parameter = currentNode.Attributes.GetNamedItem("parameter").Value;

                string        texPath        = null;
                List <string> foundTextures  = new List <string>();
                string[]      fileExtensions = new string[3] {
                    "*.psd", "*.png", "*.tga"
                };
                FindFilesInProject(fileExtensions, _meshsetRootDir, ref foundTextures);
                FindFilesInProject(fileExtensions, _sharedDir, ref foundTextures);
                FindFilesInProject(fileExtensions, _meshsetSharedDir, ref foundTextures);

                for (int i = 0; i < foundTextures.Count; i++)
                {
                    foundTextures[i] = CleanFilePathString(foundTextures[i]);
                }

                foreach (string foundTex in foundTextures)
                {
                    string texName = currentNode.Attributes.GetNamedItem("value").Value;

                    if (texName == string.Empty)
                    {
                        texPath = "none";
                        continue;
                    }

                    if (foundTex.Contains(texName))
                    {
                        texPath = foundTex;
                    }
                }

                if (texPath != null)
                {
                    meshProp.Value = (Texture)AssetDatabase.LoadAssetAtPath(texPath, typeof(Texture));
                    _meshProps.Add(meshProp);
                }
                else if (texPath == "none")
                {
                    Debug.Log(meshProp.Parameter + " : Has an empty texure reference.");
                }
                else
                {
                    Debug.LogError("Did not find texture in project.");
                }
            }
            else if (typeValue == "shader")
            {
                ZGONMeshShaderProperty meshProp = new ZGONMeshShaderProperty();
                meshProp.Name  = currentNode.Name;
                meshProp.Value = currentNode.Attributes.GetNamedItem("value").Value;
                _meshProps.Add(meshProp);
            }
        }
    }