Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to set position in Override Transform through the code

Discussion in 'Animation Rigging' started by Whiskas009, Sep 30, 2022.

  1. Whiskas009

    Whiskas009

    Joined:
    Aug 21, 2022
    Posts:
    25
    I use this component:

    upload_2022-9-30_13-5-27.png

    and I need to set the position (highlighted in red) through the code. How do I do this? All my attempts lead to an error:

    upload_2022-9-30_13-6-18.png

    upload_2022-9-30_13-9-50.png

    Tnx for answer!
     
  2. kruskal21

    kruskal21

    Joined:
    May 17, 2022
    Posts:
    68
    Hi, you may have figured this out already, but just in case. sourceObject corresponds to Override Source in the inspector. The properties you are looking for are .data.position and .data.rotation. Hope that helps!
     
    Whiskas009 likes this.