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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by SomethingStrangeStudios · Jul 13, 2014 at 02:48 PM · boxcollider2d

'center' is not a member of 'Object'

i'm getting these:

BCE0019: 'center' is not a member of 'Object'.

BCE0019: 'size' is not a member of 'Object'.

errors, when i try use this code to change the box collider size of my object

 function Start(){
 boxColl=this.GetComponent(BoxCollider2D);
 }

from what i found online this is how you obtain the boxcollider2d from the object (i tried this.BoxCollider2D.size and just BoxCollider2D.size)

 function keyMovements(){
 if (Input.GetButton("Down")){
         boxColl.center=Vector2(1.31,2.4);
         boxColl.size=Vector2(0,0);
     }else{
         boxColl.center=Vector2(1.31,2.4);
         boxColl.size=Vector2(0,0);
     }

any hints as to what i am doing wrong? i'm missing many fundamental things with unity and its causing the speed of my programming to lessen the more advanced i get with my scripts. (so use small words ;) )

Comment
Add comment · Show 6
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 gjf · Jul 13, 2014 at 02:53 PM 0
Share

where have you defined boxColl, and what type have you defined it as?

also, hopefully your code is just an example because you're setting the center & size to the same thing in both conditions.

avatar image SomethingStrangeStudios · Jul 13, 2014 at 03:04 PM 0
Share

i haven't, although i should. it's defined as

 var boxColl;

this is basically my failed attempt at creating a solution to the problem by manipulating other boxcollider questions and the documentation.

and yeah i haven't changed the x and y because i found those errors before i ended up writing them in (i copied and pasted and was just about to check what the new box collider would look like in the editor)

avatar image gjf · Jul 13, 2014 at 03:08 PM 1
Share

what happens if you change it to the following?

 var boxColl : BoxCollider2D;
avatar image SomethingStrangeStudios · Jul 13, 2014 at 03:11 PM 0
Share

Umm.. okay... i've written it just like that about 2 times and i swear i made sure that it was correctly written but it gave me lots of errors... Thanks :)

(seriously whenever i ask a question on here its the dumbest thing i've forgotten and just couldn't find)

avatar image gjf · Jul 13, 2014 at 03:12 PM 0
Share

so, did it work?

and don't worry about asking questions - it's all part of learning...

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

21 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 avatar image avatar image

Related Questions

RayCasts and BoxCollider2D not working? 2 Answers

How to make BoxColidier to have transparent side? 1 Answer

How can i detect which side of a box collider 2D the collider object collided with? 2 Answers

Boxcollider2D, Trigger not working 2 Answers

Problem with 2D collision detection (Wide object falls through a thin hole) 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