Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by holistic1 · Aug 02, 2018 at 03:15 PM · parentparent transformparent and child

Parenting an object changes its transform.

Hello, i am having a problem with parenting. After i set my scene, write my scripts and done with everything, i want to parent the objects in my scene and put it as a prefab. Before this everything works normal but after doing this position of my objects turn crazy and when i instantiate a prefab through a script that is attached to one of the objects in the scene, it just instantiates the prefab into parents position instead of the position of that object. this probably has something to do with relative position of objects to the parent but something doesn't add up. I can just remove the parent and be done with this but i'd like to understand why this happens and how to avoid it.

The code for the instantiating object(instantiated by an object in the scene which is active and always there);

 public GameObject kücükÇember;
     public static bool kontrol2;
     float zaman=0;
 
     void Start()
     {
         kontrol2 = true;
     }
 
 
     void Update()
     {
  
         if (Input.GetButton("Fire1")&&(Time.time>zaman)&&(kontrol2))
         {
             
             zaman=Time.time+0.2f;
             cemberOlustur();
         }
     }
     GameObject cemberOlustur()
     {
         return Instantiate(kücükÇember, transform.position, transform.rotation);
         
     }
 }





Pozition for object the instantiator script is attached to; before: (-0.0199 , -1.8899, 0,0677 ) after: (-56.432, -100.15, 5.0677) and parents location: (56.4127, 98.2671, -5)

The instantiated object just spawns where the parent is.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bellicapax · Aug 02, 2018 at 04:36 PM 0
Share

1) How are you parenting the objects? In the Editor or via script?

2) Can you show the code for instantiating your prefab and tell me what object it's attached to?

3) Can you give an example of the world position of the child before and after parenting?

avatar image holistic1 bellicapax · Aug 02, 2018 at 06:00 PM 0
Share

1) I do it via Unity not script. For the rest i updated the question.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

88 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I move it along with the platform while still keeping it's original scale!! 0 Answers

Im trying to a child object follow the path of the parent in the path that the parent has already traveled... 1 Answer

Make child's transform independent of parent 1 Answer

Avoid scaling GameObject after parenting 2 Answers

How to disable player gravity 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges