Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 question was closed Oct 29, 2017 at 01:26 AM by Incertam7 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Incertam7 · Oct 28, 2017 at 11:39 PM · inspectorcollidersphysics2dcollider2dparent and child

How to add colliders as objects into a public variable in the inspector?

Hi all, I am trying my hand at trying to make an Arkanoid Game. I am trying to get the paddle to work like how they do in most of these games, that is, the sides make the ball bounce at a different angle. The way I am trying to achieve this is by adding three child objects (PaddleLeft, PaddleMiddle and PaddleRight) to the parent Paddle game object and each child defines a collider for the three parts of the paddle (Left side, Middle and Right side). I've now created a public collider array for the paddle to accept each of these child objects into the array. However when I try to drag and drop the child objects into the collider array, it doesn't work. The inspector simply doesn't identify these objects as colliders I guess. So my question is how do I make the inspector identify these objects as colliders? Am I missing a component for the child objects that allows them to be identified as colliders? Or how do I create multiple colliders to a game object, each with its own behaviours?

alt text

Here is my paddle and on the side you can see the hierarchy. The Paddle has a paddle script attached to it which has an array of Colliders called colliders. I've defined the size as 3 and I am trying to add each of its child objects to it which the inspector (or Unity?) doesn't allow me to. Why?

paddle.png (150.6 kB)
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 Bonfire-Boy · Oct 29, 2017 at 12:30 AM 0
Share

In answer to your question, "Am I missing a component for the child objects that allows them to be identified as colliders?" - we can't tell as you're not showing us the make-up of the child objects. They would each need to have a collider component (of some sort) in order to be dragged onto your collider fields.

avatar image Incertam7 Bonfire-Boy · Oct 29, 2017 at 12:51 AM 0
Share

The three colliders you see on the paddle image are from each of those child objects. These are the middle and the left colliders.

alt text

alt text

padmid.png (119.6 kB)
padleft.png (107.1 kB)
avatar image Bonfire-Boy Incertam7 · Oct 29, 2017 at 12:58 AM 1
Share

Those are 2D colliders. Try making your array an array of Collider2D ins$$anonymous$$d of Collider

Show more comments

1 Reply

  • Sort: 
avatar image
1

Answer by Incertam7 · Oct 29, 2017 at 01:10 AM

I'm answering here in case anybody else had the same problem and didn't check the comments section of the question.

As mentioned in the comments by @Bonfire-Boy , Collider[] is used to define an array of 3D colliders and not 2D ones. If you're using 2D colliders on your game object, create a Collider2D array.

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

Follow this Question

Answers Answers and Comments

75 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 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 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 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

How do you keep a shot moving in the same direction/velocity after it has hit a target while allowing targets to bounce off of obstacles? 3 Answers

CircleCollider2D vs PolygonCollider2D: which collision solving is less expensive? 1 Answer

overlayCircle not working 1 Answer

Detecting top most UI element using Collider2D 0 Answers

Physics2D.OverlapArea inaccurate? 2 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