![]() Var objects = GameObject. ) or inactive objects.ĮDIT3: If you want to only get your Targets, add a script to you Target prefab called "SaveMeToFile" and use this code: string filePath = "D:/mycoords.txt" NOTE: FindObjectsOfType will not return any assets (meshes, textures, prefabs. System.IO.File.WriteAllText(filePath,coordinates) This is done by allocating a large pool of identical objects and reusing inactive, available instances from this pool instead of constantly spawning and destroying objects over time. Var objects = GameObject.FindObjectsOfType(Transform) as Transform Ĭoordinates+= "x: " + .ToString() + ", y: " + .ToString() + ", z: " + .ToString() + Object pooling is a popular technique for reducing the cost of continuous object allocation and deallocations. Writing to a text file is well-documented.Īlternatively, you may want to look into SerializationĮDIT: To do this for all objects in the scene: string filePath = "D:/mycoords.txt" The result is a Vector3 from which you can do. To get the coordinates of an object use where item is a reference to the object you want to get coordinates for.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |