Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Rebel8909 · Jul 18, 2014 at 04:54 AM · javascripterror message

How can I fix the MissingFieldException Error

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by robertbu · Jul 18, 2014 at 04:58 AM

There is an issue with your code that may be causing your problem. To start with put '#pragma strict' at the top of the file. This will generate a number of errors. The primary problem I spot is that on lines 2 and 3 you declare PosY and PosX without a type, which makes them of type Object. Then on lines 7 and 8 you treat them like floats. And then on lines 9 and 10 you treat them like GameObjects. Figure out the type and declare it at the top of the file then fix the code.

Unless you have a strong and informed reason not to, I recommend putting '#pragma strict' at the top of all of your Javascript/Unityscript files.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by drudiverse · Dec 31, 2014 at 07:57 PM

I have MissingFieldException: System.Single.Length when i ask for

foobar[].length from function(foobar:float) it shouldn't compiel but it did.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Setting Scroll View Width GUILayout 1 Answer

BCE0049 error with network script 0 Answers

Need help with WeaponSwitch Script 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges