Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 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
12
Question by kevin d · Jan 21, 2011 at 07:13 PM · runtimechangeplaymode

how do i commit changes in test mode?

i see that in unity, you can make changes while you're actually in runtime, but how do you commit the changes so they stay when you're finished?

Comment
Add comment · Show 1
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 clunk47 · May 29, 2013 at 05:33 PM 3
Share

This is actually easy. Don't run test in full screen so u can see inspector values. When you set the inspector values to what you want, right click on the component in the inspector, then click "COPY CO$$anonymous$$PONENT". When you exit playmode and are back in the editor, right click on that component again in the inspector, and click on PASTE CO$$anonymous$$PONENT VALUES. Done.

6 Replies

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

Answer by chetanisinanand · Jul 06, 2013 at 09:11 PM

Easiest Way:

  1. Enter play mode,

  2. Adjust your values,

  3. Right click on Script > "copy Component"

  4. Exit play mode,

  5. Go to original prefab > Right click on Script > "paste component as values"

And you are Done !

Comment
Add comment · Show 5 · 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 clunk47 · Jul 24, 2013 at 11:26 PM 1
Share

Accepted and voted up your answer since it is the same as $$anonymous$$e, but more easily understandable. Welcome to the community. :)

avatar image ciathyza · Sep 02, 2015 at 02:03 PM 1
Share

Hi, does anyone know if this can be done via Editor script? Like adding a button to an editor script and when the users clicks it , the current values are automatically committed?

avatar image idbrii · Sep 07, 2015 at 04:19 PM 0
Share

@avalonsutra: This answer links to a CopyInspector script that automates the process. See latest code here. (It's from 2013, so it may need updating.)

avatar image ahoogol · Dec 07, 2015 at 06:20 PM 0
Share

good answer. tnx

avatar image glenneroo · Oct 26, 2019 at 06:38 PM 0
Share

This is great but beware with (at least) particle systems, as doing this will overwrite any textures set in the Render tab.

avatar image
10

Answer by Mijdax · Feb 05, 2015 at 12:41 PM

If you had several changes in the editor you could also select all objects that have been changed. Copy them while you are in playtestmode, end the playtest mode and than delete the old stuff that has been reseted by Unity and finally paste your copied stuff in there. They will stay like you copied them in playtest mode.

Comment
Add comment · Show 5 · 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 Noah Dyer · Mar 20, 2015 at 08:38 PM 0
Share

This method is WAY better if you went ham editing lots of objects and didn't realize you were in play mode.

avatar image usernameHed · Oct 27, 2017 at 10:22 AM 1
Share

Warning this method can be VERY BAD for your project (because of prefabs, object modified by other during the play...). Apply this method with caution, for Level design or simple object only

avatar image N00MKRAD · Oct 27, 2017 at 02:10 PM 1
Share

This will break all references though.

avatar image WoofyWyzpets · Oct 08, 2018 at 11:45 PM 1
Share

One example where this can be bad is if you copy a monster that lost half his hp during the play well when you copy him back his new movespeed that you wanted to copy is there but he is also gonna start with half his hp now you have to fix it back to full.

avatar image mfatihbarut · Oct 04, 2021 at 07:57 AM 1
Share

that is not the exact solution. Because if you copy your prefabs in playmode and paste them in editor mode they turn into regular game objects unpacked.

avatar image
4

Answer by DaveA · Jan 21, 2011 at 09:53 PM

This may help: http://answers.unity3d.com/questions/1657/best-strategies-for-not-accidently-editing-whilst-still-running

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
2

Answer by eelstork · Apr 24, 2017 at 12:22 PM

You can turn an object (and all sub-objects) into a prefab whilst in play mode, which effectively saves all the changes you made to said objects (and sub-objects) After exiting play mode replace said object by the prefab and you are done.

I don't recommend this as a "quick fix" to the "Oh shucks I was editing while in play mode"; I do recommend it as a solution when play mode feels necessary to make specific changes.

While this solution won't fit every need, it's relatively selective (does not save ALL changes) and more powerful than just copy-pasting a component onto itself.

Comment
Add comment · Show 2 · 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 nbaris · Mar 15, 2018 at 02:38 PM 0
Share

Why is it more powerful than just copy-pasting component onto itself? I would guess both methods end up with a serialised-then unserialised version of the GameObject in the scene hierarchy.

avatar image eelstork nbaris · Mar 16, 2018 at 01:53 AM 0
Share

Copy-pasting component values works only for one component; if you have changed several objects or several components in just one object, you can't use that. In this respect my answer is similar to @$$anonymous$$ijdax and the benefit was noted already, by @Noah Dyer. Unlike @$$anonymous$$ijdax though I suggested that you can turn objects into prefabs. This gives you more flexibility (for example you might save several snapshots) than just replacing the objects. You are correct that the underlying mechanism (serialization) is the same. With reference to the solution suggested by $$anonymous$$ijdax, @N00$$anonymous$$$$anonymous$$RAD correctly pointed that references external to copied objects are broken (which isn't always an issue); same applies to my answer.

avatar image
0

Answer by Bob5602 · Jan 21, 2011 at 07:29 PM

You cannot. The changes you make while in "play" mode (or runtime as you put it) are only there for you to fool around with the settings during gameplay. All those changes are wiped when you stop the game. In order for them to stay, you just need to make the changes while not in runtime mode and save the scene.

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 kevin d · Jan 21, 2011 at 08:02 PM 0
Share

thanks. i was hoping that there was just some button you could press that would save them for later.

avatar image Bob5602 · Jan 21, 2011 at 09:46 PM 0
Share

Sadly not. Thats why its good practice to make sure you're not running the game while you make changes, or else you run the risk of losing a lot of time / effort when they get cancelled out.

avatar image Vox Nephila · Jul 06, 2013 at 09:06 PM 0
Share

One "cheat" is that you can copy a component, go out of play mode, and then paste in the component values.

  • 1
  • 2
  • ›

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

14 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

Related Questions

2d javascript How to change a sprite during runtime 1 Answer

Sprite alpha can't change during runtime 0 Answers

change the mesh of object during runtime using javascript 1 Answer

change terrain texture and tree at runtime 1 Answer

Export objects to a .3DS file at runtime 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