Quantcast
Channel: Questions in topic: "clone"
Viewing all articles
Browse latest Browse all 508

How do I change the transform of a clone object

$
0
0
I'm trying to change the transform of an object I've just instantiated using the following: public GameObject marker; public float maxLength; newVector = Vector2.ClampMagnitude(diffVector, maxLength); Instantiate(marker, newVector, transform.rotation); newVector = Vector2.ClampMagnitude(diffVector, maxLength); marker.gameObject.transform.position = newVector; Debug.Log("Marker position = " + marker.gameObject.transform.position); The diffVector is the difference between two objects that I want to track. There is other code around each block above but these are the pertinent parts. I use the Debug.log to see that the marker.gameObject.position.transform is changing correctly, but the actual game object marker(clone) isn't. My guess is because its a clone but I don't know how to reference them in the script. Any help would be appreciated.

Viewing all articles
Browse latest Browse all 508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>