Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 travelsound84 · Dec 18, 2021 at 09:47 AM · colliderboundswrong

Collider bounds size is 0

Hi everybody,

I have an issue with getting the correct bounds of the collider of my video player bar.

For some reason, I always get 0. I even check if the game object and it's parent object are active and I print it out:

     public void InitializeTimeLineBounds()
             {
                 float xTimeLineStart;
                 float xTimeLineWidth;
                 print("initBounds of " + transform.parent.parent.name);
                 print(gameObject.activeInHierarchy.ToString());
                 print(gameObject.activeSelf.ToString());
                 if (gameObject.activeInHierarchy == false)
                 {
                     transform.parent.parent.gameObject.SetActive(true);
                     xTimeLineStart = transform.GetComponent<Collider>().bounds.min.x;
                     xTimeLineWidth = transform.GetComponent<Collider>().bounds.size.x;
                     transform.parent.parent.gameObject.SetActive(false);
                 }
                 else
                 {
                     print("hier1");
                     //transform.parent.parent.gameObject.SetActive(true);
                     xTimeLineStart = transform.GetComponent<Collider>().bounds.min.x;
                     xTimeLineWidth = transform.GetComponent<Collider>().bounds.size.x;
                 }
                 print(xTimeLineStart);
                 print(xTimeLineWidth);
             }

Here is what I get printed: ![alt text][1]

And this is what the GameObject in the inspector looks like in play mode: ![alt text][2]

Does anybody have an idea what's causing the variable xTimeLineWidth to be 0? I have commented the "transform.parent.parent.gameObject.SetActive(true);" line, because from the printout I can see that it is actually active. Even uncommented I get the same issue. [1]: /storage/temp/190108-screenshot-2021-12-18-at-103451.png [2]: /storage/temp/190109-screenshot-2021-12-18-at-103715.png

screenshot-2021-12-18-at-103451.png (105.6 kB)
screenshot-2021-12-18-at-103715.png (277.9 kB)
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

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

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

Bounds is 0 when Instantiated 2 Answers

Converting Collider to Bounds variable? 1 Answer

My object is going through boundaries Problem! 1 Answer

Bounds with Rotation: Getting y value of the point where its on the most left side of the collider (bounds.min.x) Note that the box collider has been rotated as well. 2 Answers

How does Unity's Collider.Bounds work? 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