Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 /
  • Help Room /
avatar image
0
Question by AlexEvangelou · Dec 08, 2015 at 01:43 AM · collision2dviewport

Maximizing Viewport changes game behavior

Ok so here's a weird one. When I run my game in the editor without the game viewport maximized it behaves as expected. Then when I maximize the viewport "OnTriggerStay2D" stops firing. The game can be running in play mode, working fine, then without stopping I can maximize the viewport and I stop getting those triggers.

The game window doesn't change size, it's 1334x750 either way, it just gets more padding around it when maximized.

It doesn't seem like maximizing the viewport should have any effect whatsoever on the running game but it clearly does. I have no clue how to even debug something like this.

 void OnTriggerStay2D(Collider2D other) {
         
     //Debug.Log (other.gameObject.name);
     //drawDebugRect (other.collider2D.bounds.min, other.collider2D.bounds.max);
 
     //If the drill trigger is in the block call reduce health
     if (other.gameObject.CompareTag("Drill") ) {

             //ADDED TO CHECK THIS BUG ONLY
         Debug.Log (Time.time);

         //OrientedBlock block = transform.parent.gameObject.GetComponent<OrientedBlock>();
         x = Mathf.FloorToInt(myTransform.localPosition.x);
         y = Mathf.FloorToInt(-myTransform.localPosition.y);    
             
         float damage = ((Drill)other.gameObject.GetComponent("Drill")).damagePerSecond * Time.deltaTime;
         health = levelManager.reduceBlockHealth (x,y,damage);
     }
 }

It the Debug.Log statment stops outputing to the console in maximized but outputs just fine when not maximized.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by waruban · Dec 05, 2019 at 11:46 PM

@ AlexEvangelou Same issue 2019... Anyone ???,same issue... 2019. I would appreciate if someone can share any feedback on this .

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

Answer by jamesjac · Feb 16, 2021 at 04:50 PM

same thing happened to me when I was adding force to an object, when I have the game window be a small window in the corner it behaves differently from when I maximize it. What seems to fix it is multiplying the values by Time.deltaTime as you can see here:

 Vector3 ammont = new Vector3(0, 5000, 0);
 GetComponent<Rigidbody>().AddForce(ammont * Time.deltaTime);

This fixed it and I don't know why but I think it has something to do with fps.

Comment
Add comment · Show 1 · 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 jamesjac · Feb 16, 2021 at 04:51 PM 0
Share

I know its 6 years late, but I hope your still making games.

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

35 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

Related Questions

How To Set ScrollRect.NormalizedPosition And Continue Existing Inertia 0 Answers

Missing shadows when using a custom oblique projection matrix 0 Answers

Why after changing variable s value it returns at the original value? 0 Answers

OnTriggerEnter2D not reseting when collider gets disabled 0 Answers

Collision detection on object moving into each other 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