I create a C # script in which I declare a transformation: public Transform Origin;

When I put this script on an object of the hierarchy, in the Inspector a field Origin appears at the level of the script in which I have to drag and drop a transformation of a GameObject or a GameObject.

How does the Origin transformation deal with the GameObject transformation to move in this field?

Thank you for your help

  • \$\begingroup\$ Can you expand on what you mean by "how does it deal"? What's an example operation that you want to perform? Have you found a way to do that operation? Is the result different than you expected? \$\endgroup\$
    – DMGregory
    Apr 8 '19 at 11:45

A Transform component is always bound to one specific game object. You can't have a Transform object which exists separately without one.

If you want to pass transformation information around, then you might want to use separate variables Vector3 originalPosition, Quaternion originalRotation and Vector3 originalScale.

Another possible option might be to place an invisible game object at your origin and reference that game object. This can be more convenient for you as the developer because you can see and move the origin-point in the scene view. If you want to visualize a Vector3 inspector property, you need to program an editor extension.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.