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
0
Question by root8888 · Apr 04, 2014 at 06:14 PM · objectsaveitweenpositions

What is the best way to store a large number of object positions?

My game has many levels. Each level has 50-200 objects in it. I would like to store multiple positions for each object and use iTween to move between them. It would be nice if I didn't have to manually enter the x/y/z for every single object. It would be great if I could store the positions somehow in an array, then move all the objects in the scene view and then store those positions in another array. Does anyone have any suggestions? PlayerPrefs doesn't seem to be a logical place to save such a thing. I looked into Unity Serializer, but it hasn't been updated in a long time. When I added it to my project, there were so many errors that it was unusable.

Comment
Add comment · Show 2
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 robertbu · Apr 04, 2014 at 06:50 PM 0
Share

If you are talking about runtime, then take a look at:

http://wiki.unity3d.com/index.php/ArrayPrefs2

But it sounds to me like you are taking about edit time. You can develop your own editor script. If you are going to be using iTween, you might take a look at the iTween path editor:

http://pixelplacement.com/2010/12/03/visual-editor-for-itween-motion-paths/

avatar image root8888 · Apr 05, 2014 at 09:06 PM 0
Share

Yes, I am talking about edit time. The positions of the objects would need to be saved and distributed with the game itself. Thanks!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by patrik-org · Apr 04, 2014 at 06:44 PM

I'd create the path by placing gameObjects for the waypoints in the path. The waypoint gameObjects would have parameters for the path they belong to and the waypoint order number. Your script then just finds all waypoint gameObjects and creates paths from them. That way you can see your path visually in your scene and can easily alter them if you need to.

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 root8888 · Apr 05, 2014 at 09:05 PM 0
Share

This sounds like a good solution, but I'm not sure how it would work in my situation. Consider this. I have 200 objects with rigidbodies and they are all placed in their "home" position. Then the user does some things in the level that move all the objects around and hits a reset button. The reset will iTween.$$anonymous$$oveTo all the objects back to their "home" position. I can surely make a homePosition property on every single object, however, I am dreading typing in x,y,x values for thousands of objects.

avatar image patrik-org · Apr 05, 2014 at 09:35 PM 0
Share

I see.. what if you don't have a home-position property but rather as the level starts you loop through all your relevant rigidbodies and store their position in separate lists. You could at regular intervals see if an object has moved and then add their new position to the relevant list - you have your paths ready to be itweened.

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

21 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

Related Questions

Getting any type in Unity Inspector 1 Answer

Saving Object Name in a database when it is clicked ? 0 Answers

Push an object along a path? 2 Answers

Get object/prefab name as string. 1 Answer

SAVE OBJECTS IN ARRAY 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