I need help with an error - MissingFieldException: System.Single.Time
Error:
MissingFieldException: System.Single.Time Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.FindExtension (IEnumerable`1 candidates) Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.Create (SetOrGet gos) Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.CreateGetter () Boo.Lang.Runtime.RuntimeServices.DoCreatePropGetDispatcher (System.Object target, System.Type type, System.String name) Boo.Lang.Runtime.RuntimeServices.CreatePropGetDispatcher (System.Object target, System.String name) Boo.Lang.Runtime.RuntimeServices+c_AnonStorey17.<>m_C () Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.GetProperty (System.Object target, System.String name) UnityScript.Lang.UnityRuntimeServices.GetProperty (System.Object target, System.String name)
Script:
var Distance;
var Target : Transform;
var lookAtDistance = 25.0;
var chaseRange = 15.0;
var attackRange = 1.5;
var moveSpeed = 5.0;
var Damping = 6.0;
var controller : CharacterController;
var attackRepeateTime = 1;
private var attackTime : float;
var gravity : float = 20.0;
private var MoveDirection : Vector3 = Vector3.zero;
function start ()
{
attackTime = Time.time;
}
function Update ()
{
Distance = Vector3.Distance(Target.position,transform.position);
if (Distance < lookAtDistance)
{
lookAt();
}
if (Distance > lookAtDistance)
{
GetComponent.<Renderer>().material.color = Color.green;
}
if (Distance < attackRange)
{
attack();
}
else if (Distance < chaseRange)
{
chase ();
}
}
function lookAt()
{
GetComponent.<Renderer>().material.color = Color.yellow;
var rotation = Quaternion.LookRotation(Target.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * Damping);
}
function chase()
{
GetComponent.<Renderer>().material.color = Color.red;
MoveDirection = transform.forward;
MoveDirection *= moveSpeed;
MoveDirection.y -= gravity.Time.deltaTime;
controller.Move(MoveDirection * Time.deltaTime);
}
function attack()
{
if (Time.time > attackTime)
{
Debug.Log("attack");
attackTime = Time.time + attackRepeateTime;
}
}
Your answer
Follow this Question
Related Questions
How do I calculate the angle between where an entity is facing and a target. 2 Answers
Flashlight script wont follow firstperson 0 Answers
how to change a buttons function with a script? 2 Answers
Activate Navigation Script after button gets pressed 0 Answers
Unity relative animations (Frequently asked but I don't get it) 1 Answer