Hi.
I am referencing a prefab’s animationClip in a script. It works fine in the editor, but throws this error in the standalone windows build.
MissingMethodException: Cannot find
the requested method. at (wrapper
managed-to-native)
UnityEngine.Motion:get_averageDuration
() at PrefabScript.get_animLength ()
[0x00000] in D:\Workspaces\Unity\Test
Bed\Assets\Prefab
Referencing\PrefabScript.cs:12 at
Main.Start () [0x00000] in
D:\Workspaces\Unity\Test
Bed\Assets\Prefab
Referencing\Main.cs:11 (Filename:
D:/Workspaces/Unity/Test
Bed/Assets/Prefab
Referencing/PrefabScript.cs Line: 12)
I’m using the following scripts
using UnityEngine;
using System.Collections;
public class Main : MonoBehaviour {
public PrefabScript prefab;
// Use this for initialization
void Start ()
{
Debug.Log(prefab.animLength.ToString());
}
}
using UnityEngine;
using System.Collections;
public class PrefabScript : MonoBehaviour
{
public AnimationClip anAnimation;
public float animLength
{
get
{
return anAnimation.averageDuration;
}
}
}
All references and public variables are properly set. Can anyone shed any light on why this works in the editor and not on a stand alone windows build?