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
2
Question by Ron Jones · Sep 01, 2010 at 01:23 AM · physicspausecamera-lookstopping-animationunpause

How do I pause and unpause only some GameObjects at a time

Hey this is my first game I'm designing. I'm trying have to two or three "worlds" in a level. When I hit the spacebar from my initial character, I want to be able to toggle through the list of characters (one on each world) and hit spacebar again and only unpause that "world" and character that the camera is targeted on.

I want to do this accurate so when i play with one character and if i pause mid-jump, I can change to someone else, play their part, then come back and still be in the air with the initial character.

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
3
Best Answer

Answer by Jesse Anders · Sep 02, 2010 at 05:49 AM

What I would try is enabling and disabling the appropriate components as appropriate. You'll want to enable/disable your own scripts that do any movement or other updating, and also any particle systems and rigid bodies. I don't believe the rigidbody component can be disabled per se, but setting a rigid body to 'kinematic' (if it's not kinematic already) should have the same effect.

The second part of the problem is identifying all of the appropriate game objects based on which world you want to pause/unpause. There's more than one way this problem can be solved, but possible solutions would be to query for game objects based on layers or tags. By combining this with GetObjectsOfType(), you can acquire all of the particle systems, rigid bodies, and other component types that you're interested in, and then check the tags/layers/other metadata to see which should be enabled and which disabled. (I've read that GetObjectsOfType() can be slow in some cases. I don't know whether it would be a problem in this scenario, but I'd go ahead and try it and see how it performs.)

One trick I've used for pausing is to derive all of the monobehaviours that I want to be pausable from a 'Pausable' base class. The 'Pausable' class simply derives from Monobehaviour, and does nothing more; it simply serves as a 'tag' of sorts that allows GetObjectsOfType() to find these components easily. (This is in C#; I'm not sure if/how this can be done in UnityScript or Boo, although I imagine something similar would be possible.)

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 Ron Jones · Sep 03, 2010 at 01:26 AM 0
Share

Thanks for answering man... So for the script, would it be like GetObjectsOfType(World1)... meaning everything i've tagged world1 in world 1...

avatar image · Sep 03, 2010 at 01:32 AM 1
Share

Read up on FindWithTag (http://unity3d.com/support/documentation/ScriptReference/GameObject.FindWithTag.html) and FindObjectsOfType (http://unity3d.com/support/documentation/ScriptReference/Object.FindObjectsOfType.html). There are examples on both pages.

avatar image Ron Jones · Sep 03, 2010 at 08:23 AM 0
Share

Thanks you guys, I'll try this and see what I run into.

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

No one has followed this question yet.

Related Questions

AR foundation with Fixed update Camera tracking 0 Answers

How to know if Audio is Paused? 2 Answers

Game stays paused after Restart. 1 Answer

Stop physics without Time.timeScale 1 Answer

why cant i play my scene? 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