So I’ve been trying to make a puzzle game for one of my old teachers. I’ve been working on a script but whenever I use it it gives me this error:
MissingFieldException: System.Single.transform
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)
UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32, Int32)
Here’s the Script:
var Empty : Transform;
var PosY;
var PosX;
function OnMouseUp(){
if (Vector3.Distance(transform.position,Empty.position)==1){
PosY = transform.position.x;
PosX = transform.position.y;
PosY.transform.position = Empty.position.y;
PosX.transform.position = Empty.position.x;
Empty.position = PosX;
Empty.position = PosY;
}
//empty ray
var hit : RaycastHit;
//spawn said ray at mouse position
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray,hit)){
//Print out the objects name in Console
Debug.Log(hit.collider.name);
}
}
If you could tell me whats wrong and how I could fix it that’d be great. I’ve already tried looking around and unless I’m blind I cant find anything on this. Again any help would be appreciated.