• 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 MrMatijs · Mar 10, 2014 at 07:01 PM · movementrigidbodytransformwindowminimize

Keep moving when window is minimized

This is my little code:

 rigidbody.transform.position += rigidbody.transform.right * speed * Time.deltaTime;

So this will move the transform forward, constantly, but when I minimize the screen, or even close it, it will stop moving, I want to know how to make it so it keeps moving forward even when the window is minimized or closed (closed because this is multiplayer).

Thanks in advance.

Matijs

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Sildaekar · Mar 10, 2014 at 07:13 PM

I'm not sure how to make it keep moving when the window is minimized, but this is NOT possible to do via client side when the window is closed. When a program is closed the stack is erased and all objects are removed from memory.

Your best bet would be to create an Authoritive Server (where the server controls everything and the client just tells it what's going on with them). Then on the server you could have objects continuing to move.

Check out these links:

http://forum.unity3d.com/threads/112430-Authoritative-server-example-demo

http://playblack.net/zee-code/unity-3d-authoritative-server-networking-pt1

http://forum.unity3d.com/threads/199538-Tips-for-server-authoritative-player-movement

http://forum.unity3d.com/threads/136561-Networking-Tutorial

Comment
Add comment · Show 3 · 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 MrMatijs · Mar 10, 2014 at 07:32 PM 0
Share

Thanks alot, i'll check this out if there is no other way, cause I dont want everything to be server side. Is there a way to see like: If window is closed then... ?

avatar image Sildaekar · Mar 10, 2014 at 07:41 PM 0
Share

Here are a few other topics I found that should point you in the right direction to detect if the application is being closed:

http://answers.unity3d.com/questions/54674/is-there-a-way-to-know-when-the-application-is-in.html

http://answers.unity3d.com/questions/224215/how-to-detect-in-ondestroy-if-scene-is-closinggame.html

http://answers.unity3d.com/questions/167984/call-a-function-when-app-exits.html

If this answers your questions please don't forget to mark this answer :)

avatar image MrMatijs · Mar 10, 2014 at 07:57 PM 1
Share

Yeah, thats what I need, thanks

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.

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

22 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

Related Questions

Moving a kinematic object a fixed distance over a set time with physics in mind 2 Answers

Clamping rigidbody's Z position causing issues in the editor, when transform hits zero on Z axis 0 Answers

[SOLVED] Object keeps sliding? 2 Answers

Npc Movement 0 Answers

stop vehicle from moving through walls 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