Hello I have some trouble with my build for UWP. My script as shown below works great in editor, pc stand alone , Mac stand alone, Mac App Store, but throw Exception in master build with .NET native and it come up that it could be because of my script that manage animation speed of a key-frame animation single layer
I have already ask for help in the windows part of the forum but I would like to know if you guys from the "script department " you see anything wrong with my script it may look messy but it works everywhere except in master build +.NET native
it says that state.speed is the issue but I donât know how to fix that I need state.speed to define my animation speed :s
could you guys please have a quick look at it and maybe tel me where Iâm wrong ?
here is the javascript ( sorry I m not good at C#):
#pragma strict
var speed=1.0;
var speed2=-1.0;
var speed3=0.0;
var speed4=2.0;
var speed5=0.3;
var Cam12: Camera;
function Update () {
// Set all animations to pingpong
//
GetComponent.<Animation>().wrapMode = WrapMode.Loop;
for (var state : AnimationState in GetComponent.<Animation>()) {
if ( Input.GetMouseButtonDown(0) )
{
// bit shift the index of the layer to get a bit mask
var layerMask = 1 << 9;
// Does the ray intersect any objects which are in the player layer.
//if (Physics.Raycast (transform.position, Vector3.forward, Mathf.Infinity, layerMask))
//print ("The ray hit the player");
var hit : RaycastHit;
var ray : Ray = Cam12.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, hit, 1000.0))
{
Debug.Log(hit.collider.gameObject.name);
if (hit.collider.gameObject.tag== "stop")
{
state.speed = speed;
GetComponent.<Animation>().Rewind();
GetComponent.<Animation>().Play();
}
if (hit.collider.gameObject.tag== "fastrewind")
{
state.speed =speed2;
}
if (hit.collider.gameObject.tag== "pause")
{
state.speed =speed3;
}
if (hit.collider.gameObject.tag== "play")
{
state.speed =speed;
}
if (hit.collider.gameObject.tag== "fastforward")
{
state.speed =speed4;
}
if (hit.collider.gameObject.tag== "slowmo")
{
state.speed =speed5;
}
// else state.speed =speed;
}
}
}
}
and here is the VS error
Thank you very much!