The problem is found at line 30 the command thing said: Assets/GameContent/Motiontracks/Editor/AnimationImporter.cs(30,58): error CS1525: Unexpected symbol `static’
if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Xml;
using UnityEditor;
using UnityEngine;
class ImportAnimationsClips : AssetPostprocessor
{
public static void Process(GameObject DestinationAsset, string objectName, XmlDocument doc, int total)
{
ImportAnimationsClips clips = new ImportAnimationsClips();
clips.ProcessAnimations(DestinationAsset, objectName, doc, total);
}
void ProcessAnimations(GameObject DestinationAsset, string objectName, XmlDocument doc, int total)
{
Debug.Log("Starting animation split process...");
string assetPath = AssetDatabase.GetAssetPath(DestinationAsset);
if (assetPath.Contains(objectName))
{
ModelImporter modelImporter = ModelImporter.GetAtPath(assetPath) as ModelImporter;
//modelImporter.clipAnimations = true;
modelImporter.generateAnimations = ModelImporterGenerateAnimations.InRoot;
// Set the number of animations here
int numAnimations = total; static void =ClearLog()
{
/*Assembly assembly = Assembly.GetAssembly(typeof(Macros));
Type type = assembly.GetType("UnityEditorInternal.LogEntries");
MethodInfo method = type.GetMethod("Clear");
method.Invoke(new object(), null);*/
}
ModelImporterClipAnimation[] animations = new ModelImporterClipAnimation[numAnimations];
XmlNodeList list = doc.GetElementsByTagName("Data");
int i = 0;
foreach (XmlNode node in list)
{
XmlAttributeCollection child = node.Attributes;
string name = "";
int sf = 0;
int ef = 0;
foreach (XmlNode nd in child)
{
if (nd.Name == "name")
name = nd.Value;
if (nd.Name == "startFrame")
sf = int.Parse(nd.Value.Replace("f", ""));
if (nd.Name == "endFrame")
ef = int.Parse(nd.Value.Replace("f", ""));
}
bool loop = false;
string nm = name.ToLower();
if (nm.Contains("idle") || nm.Contains("walk") || nm.Contains("sprint") || nm.Contains("run") || nm.Contains("strafe"))
loop = true;
animations *= SetClipAnimationNew(nm, sf, ef, loop);*
i++;
}
modelImporter.clipAnimations = animations;
Object asset = AssetDatabase.LoadAssetAtPath(assetPath, typeof(GameObject));
EditorUtility.SetDirty(asset);
AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate);
}
}
private ModelImporterClipAnimation SetClipAnimationNew(string name, int firstFrame, int lastFrame, bool loop)
{
ModelImporterClipAnimation mica = new ModelImporterClipAnimation();
mica.name = name;
mica.firstFrame = firstFrame;
mica.lastFrame = lastFrame;
mica.loop = loop;
if (loop)
mica.wrapMode = WrapMode.Loop;
else
mica.wrapMode = WrapMode.Once;
return mica;
}
}
public class AnimationImporter : UnityEditor.ScriptableWizard
{
public GameObject DestinationAsset;
public TextAsset xmlAnimationFile;
void OnWizardOtherButton()
{
this.Close();
}
void OnWizardCreate()
{
Debug.Log(xmlAnimationFile.GetType());
if (DestinationAsset == null)
{
ShowMessage(“Motiontracks.org”, “Select the Correct Asset to Split Animations.”, “OK”);
return;
}
if (xmlAnimationFile == null)
{
ShowMessage(“Motiontracks.org”, “Select the Correct motionData XML file.”, “OK”);
return;
}
string str = xmlAnimationFile.text;
XmlDocument doc = new XmlDocument();
doc.LoadXml(str);
XmlNodeList list = doc.GetElementsByTagName(“Data”);
if (list.Count == 0)
{
ShowMessage(“Motiontracks.org”, “No animations found at XML file.”, “OK”);
return;
}
ImportAnimationsClips.Process(DestinationAsset, DestinationAsset.name, doc, list.Count);
}
static void ShowMessage(string title, string content, string button)
{
UnityEditor.EditorUtility.DisplayDialog(title, content, button);
}
}
#endif