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 luniac · Aug 15, 2014 at 02:08 PM · transformarraycopy

quick copy transform properties into array in editor

I have 3 big Vector3 array which will contain position,rotation,scale for a transform in the scene.

For each index in the array, i position the transform where it needs to be and copy the 3 position values into the 3 vector 3 slots in the array, same with rotation and scale.

This will take a very long time to do manually, is there any editor script available that will copy transform properties and allow me to paste them into arrays?

I've looked and looked but all i've found was copying and pasting transform stuff into other transforms, but not arrays.

Any help would be VERY appeciated.

Comment
Add comment · Show 4
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 gjf · Aug 15, 2014 at 04:44 PM 0
Share

are you planning on creating new game objects for each of the entries in your array, or do they already exist?

avatar image luniac · Aug 15, 2014 at 05:04 PM 0
Share

its one object whos transform values are updated at runtime using values from the array.

In editor i reposition the object around to get the values to store in the array in the first place which i will recall in play. I was just lookin for a quicker way to copy values from the transform into the array without going copy/paste on X then Y then Z of position and scale and rotation.

$$anonymous$$aking 2 inspectors helps a lot though, since i can have the object transform and the array slots side by side for quick copy/pasting action.

avatar image gjf · Aug 15, 2014 at 06:04 PM 0
Share

you might try a custom inspector on your object with a button to add the required info of the array(s)

avatar image luniac · Aug 16, 2014 at 11:43 AM 0
Share

I was looking into that whole custom editor stuff with the goal to create a button of some sort like you said to copy it over, but i wont lie, editor mods are not my cup of $$anonymous$$. Thank you though.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Chris_Dlala · Aug 15, 2014 at 10:21 PM

I would advise to add a serialized or public array or transforms in the script where you want the array. Then you can create a new GameObject for each transform you want and drag it into the array in the inspector. This reference to the transform will give you the data you want and has the bonus of allowing you to select and see what each position/rotation/scale would look like and allow you to edit them easily.

We use a similar design to allow the designers to position spawn points in a level. If you combine this with Gizmos you can make them visible and selectable in the scene view.

I hope that helps =D

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 luniac · Aug 16, 2014 at 11:41 AM 0
Share

I was thinking of doing that, but im gonna probably have over 1000 variations so I was under the impression that making a new transform each time would put quite a strain on the memory.

avatar image Chris_Dlala · Aug 16, 2014 at 04:39 PM 0
Share

Hi, I've not done many stress tests on a lot of empty GameObjects but I would have thought that if they're not nested too deeply (near the root in the hierarchy) and are set to static it shouldn't be too expensive...?

avatar image luniac · Aug 28, 2014 at 03:46 AM 0
Share

oh i see what you're saying. Not sure to be honest whether the transform empty object contains a lot of extra information that i don't need and would take up more space.

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

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

How can I simplify this script? 0 Answers

C# Variables Transform vs GameObject 1 Answer

Copy From Array to List without reference [C#] 2 Answers

List and store vector3 of game objects with tag 1 Answer

Moving multiple transforms from an array in a single script 0 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