I have a simple prefabricated object called platform. It is just a cube. Then I have a simple script saying Instantiate when I press the left or right arrow keys (platform, wantedPosition, Quaternion.identity), but I want unity to remember the object that was last instantiated, and I want to access that platforms position in the 3D space through a script. I want the last instantiated platforms position as a Vector3 currentPlatformPosition. Any ideas on how to do this?,
Solution 1: Getting the World position.
public Vector3 currentPlatformPosition;
currentPlatformPosition = Instantiate(platform, wantedPosition, Quaternion.identity).transform.position;
Solution 2 (recommended): Getting the transform
public Transform currentPlatformPosition;
currentPlatformPosition = Instantiate(platform, wantedPosition, Quaternion,identity).transform;