• 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 /
This question was closed Mar 31, 2015 at 06:06 PM by tanoshimi for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by conoman316 · Mar 25, 2015 at 12:34 PM · script error

error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected

 using UnityEngine;
 using System.Collections;
 
 public class playercontroller : MonoBehaviour 
 {
         void FixedUpdate ()
         {
             float moveHorizontal = Input.GetAxis ("input.Horizontal");
             float moveVertical = Input.GetAxis ("input.Vertical");
 
             Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
         
         GetComponent<Rigidbody>(Vector3);
         }
 }
     
         
 
         
 
Comment
Add comment · Show 2
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 conoman316 · Mar 25, 2015 at 12:29 AM 0
Share

it also displays: "error CS0308: The non-generic method `UnityEngine.Component.GetComponent(System.Type)' cannot be used with the type arguments" i was copying the code for the "roll a ball" project and this is after i fixed it after it said i didnt have my vertical axis setup and now it won t let me play until i fix it.

avatar image meat5000 ♦ · Mar 30, 2015 at 02:37 PM 0
Share

$$anonymous$$oderators

Answers/answering comments from mod queue should be set to "Visible by Everyone" to avoid disappearing answers when converted.

1 Reply

  • Sort: 
avatar image
2

Answer by Landern · Mar 25, 2015 at 12:37 PM

on line 13, you're passing a TYPE, the type is Vector3, it expected the type to be constructed and qualified.

 GetComponent<Rigidbody>(Vector3);

should have a value of some sort.

 GetComponent<Rigidbody>().AddForce(new Vector3(1.1f, 2.5f, 0));

Vector3 also supplies simple Vector3 objects(forward, back, etc.) which you can see as static variables that return Vector3 objects, this is described at the beginning of the Vector3 documentation.

Comment
Add comment · Show 5 · 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 conoman316 · Mar 25, 2015 at 05:23 PM 0
Share

I'll try fixing that thank you it stopped throwing errors but now the problem is the ball won't move, maybe this will fix that thank you again.

avatar image conoman316 · Mar 25, 2015 at 05:58 PM 0
Share

@Landern i'm very sorry as i'm just trying to learn to code but what do the values represent? (1.1f, 2.5f, 0) are these supposed to be the coordinate of the object i'm trying to put input into? i tried putting exactly what you put as a example and it now has one error stating:"No overload for method 'GetComponent' takes '1' arguments"

avatar image shoffing · Mar 25, 2015 at 06:00 PM 2
Share

Are you trying to get the rigidbody to move? Try this:

 GetComponent<Rigidbody>().AddForce(movement);

See here: http://docs.unity3d.com/ScriptReference/Rigidbody.AddForce.html

avatar image conoman316 · Mar 25, 2015 at 06:09 PM 0
Share

holy crap that worked but now "Unhandled Exception: System.UnauthorizedAccessException: Access to the path "C:\Users\conoman316\Documents\games\New folder\roll a ball\Temp\Assembly-CSharp.dll.mdb" is denied." its denying access to the folder??

avatar image meat5000 ♦ · Mar 30, 2015 at 02:35 PM 0
Share

Thats a Windows issue. Open Unity in Ad$$anonymous$$ mode. This QA is answered.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Best Practice Exception Handing Addressables Key Not Found? 3 Answers

all my scripts stopped working after i put a enemy spawner script in 0 Answers

HostListReceived symbol resolve 1 Answer

error CS1525: Unexpected symbol 'rigidbody' 1 Answer

Why I can't add c# script with the correct name ? 1 Answer


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