- Home /
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.
are you planning on creating new game objects for each of the entries in your array, or do they already exist?
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.
you might try a custom inspector on your object with a button to add the required info of the array(s)
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.
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
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.
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...?
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.