Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by Entyro · Sep 18, 2013 at 01:52 PM · clothremovewind

Cloth problem

Hi!

I have a problem when I pause my game with an cloth object in the level. I can pause the game but when I resume the game it freezes for some seconds and then I get 2 errors and the cloth in level disappears.

PauseScript.js

 var paused : boolean = false;
 var Target1 : GameObject;
 var Target2 : GameObject;
 var Target3 : GameObject;
 var texture : GUITexture;
 var pause : AudioClip;
  
 function Update ()
 {
  
     Pause();
  
 }
  
 function Pause()
 {
  
     if(Input.GetKeyDown("escape") && paused == false)
           {
  
          AudioSource.PlayClipAtPoint(pause, transform.position);
          //yield WaitForSeconds(0.3);
          paused = true;  
          Time.timeScale = 0;
          savedTimeScale = Time.timeScale;
            doPauseWindow = true;
            Time.timeScale = 0;
            AudioListener.volume = 0;
          Target1.GetComponent("MouseLook").enabled = false;
              Target2.GetComponent("MouseLookCamera").enabled = false;
              Target3.GetComponent("CrosshairSimple").enabled = false;
              gameObject.Find("PausetextureBlack").guiTexture.enabled = true;
              Screen.showCursor = true;
         Screen.lockCursor = false;
         texture.enabled = true;
          }
  
                else if(Input.GetKeyDown("escape") && paused == true) {
  
                 paused = false;
                 Time.timeScale = 1;
                   AudioListener.volume = 1;
                   AudioSource.PlayClipAtPoint(pause, transform.position);
                   Target1.GetComponent("MouseLook").enabled = true;
                   Target2.GetComponent("MouseLookCamera").enabled = true;
                   Target3.GetComponent("CrosshairSimple").enabled = true;
                   gameObject.Find("PausetextureBlack").guiTexture.enabled = false;
                   Screen.showCursor = false;
                Screen.lockCursor = true;
                texture.enabled = false;
  
     }   
  
 }


Error

alt text

error.png (20.6 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

2 Replies

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

Answer by jheiling · Sep 18, 2013 at 02:42 PM

Waiting for one frame before enabling the cloth again worked for me.

Comment
Add comment · Show 4 · 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 Entyro · Sep 18, 2013 at 02:45 PM 0
Share

What do you mean? How do I do that?

avatar image jheiling · Sep 18, 2013 at 03:15 PM 0
Share

Sorry, that wasn't clear at all... disable the cloth component on pause (it should still get rendered, but without cloth simulation), then enable it again one frame after continuing. Enabling / disabling SkinnedCloth can look quite ugly though, so maybe you should use SetEnabledFading.

avatar image Entyro · Sep 20, 2013 at 02:59 PM 0
Share

Thanks, that worked! :D Added a cloth variable and then added this line on the pause event "cloth.enabled = false;"

avatar image jheiling · Sep 20, 2013 at 05:11 PM 0
Share

You're welcome!

avatar image
0

Answer by evenwang35 · Mar 28, 2014 at 06:46 AM

hello, i am faced with the same question, my clothes disappear when i unpause the game. i used GameObject.Find("tp1").GetComponent(InteractiveCloth).enabled = false; before i pause the game, but it doesnt work. is there anything wrong with my codes?

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 Entyro · Mar 28, 2014 at 09:25 AM 0
Share

Add a cloth variable ins$$anonymous$$d and add the line "cloth.enabled = false". After that you can drag and drop the cloth object to the script in the inspector

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

17 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

Related Questions

Multiple Cars not working 1 Answer

Unity is stuck on White screen every time i open it. 1 Answer

Inventory system Help 2 Answers

Problem with transform.Rotate 1 Answer

Destroyable barrier 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