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 GujaratiGuy789 · Feb 20, 2014 at 02:45 AM · errorfindcant

BCE0044 and UCE0001 Error Need Help!!!

 #pragma strict
 
 var MyCube = function MyCube() {
     var positionX : int;
     var positionY : int;
     var positionZ : int;
 };
 
 function Update () {
     Transform.position.X = MyCube.positionX;
     Transform.position.Y = MyCube.positionY;
     Transform.position.Z = MyCube.positionZ;
     
     if(Input.getKey("q")) {
         MyCube.positionX = MyCube.positionX + 1;
     }
     
     if(Input.getKey("a")) {
         MyCube.positionX = MyCube.positionX - 1;
     }
     
     if(Input.getKey("w")) {
         MyCube.positionY = MyCube.positionY + 1;
     }
     
     if(Input.getKey("s")) {
         MyCube.positionY = MyCube.positionY - 1;
     }
     
     if(Input.getKey("e")) {
         MyCube.positionZ = MyCube.positionZ + 1;
     }
     
     if(Input.getKey("d")) {
         MyCube.positionZ = MyCube.positionZ - 1;
     }
 }

I can't seem to find the error in my codealt text

The semicolon 7 is supposed to be there because it is a variable with a function inside. This code is in javascript.

screen shot 2014-02-19 at 6.33.27 pm.png (16.9 kB)
Comment
Add comment · Show 1
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 getyour411 · Feb 20, 2014 at 02:46 AM 0
Share
  1. Format code properly with 10101 button

  2. Your opening declaraction of var mycube = function mycube() doesn't look like legal syntax to me, but I use C#

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by robertbu · Feb 20, 2014 at 07:07 AM

This may be what you are looking for. In addition to the issue @getyour411 points out where you are using a function where you should be using a class, you have these issues:

  • You want to use 'transform' not 'Transform'. 'Transform' with an upper case 'T' is the class. Lower case 'transform' is the instance on this game object.

  • transform.position x,y, and z values are lower case

  • getKey should be 'GetKey'.


    pragma strict

    class MyCubeClass extends System.Object { var positionX : int; var positionY : int; var positionZ : int; };

    var MyCube = new MyCubeClass();

    function Update () { transform.position.x = MyCube.positionX; transform.position.y = MyCube.positionY; transform.position.z = MyCube.positionZ;

       if(Input.GetKey("q")) {
            MyCube.positionX = MyCube.positionX + 1;
         }
      
         if(Input.GetKey("a")) {
            MyCube.positionX = MyCube.positionX - 1;
         }
      
         if(Input.GetKey("w")) {
            MyCube.positionY = MyCube.positionY + 1;
         }
      
         if(Input.GetKey("s")) {
            MyCube.positionY = MyCube.positionY - 1;
         }
      
         if(Input.GetKey("e")) {
            MyCube.positionZ = MyCube.positionZ + 1;
         }
      
         if(Input.GetKey("d")) {
            MyCube.positionZ = MyCube.positionZ - 1;
         }
     }
    
    

Note this code expects the initial values of 'MyCube' to be set in the inspector.

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

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Setting up health script. will not work, 1 Answer

Can't Find Animation 0 Answers

GameObject.Find no longer working for specific classes 1 Answer

Bot Controller Script? 0 Answers

Can't export game to WebGL??? | Failed running InternalCallRegistrationWriter.exe ? 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