Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 CrucibleLab · Nov 08, 2012 at 03:41 AM · gameobjectprefabpositioninitialization

Initializing Prefab Position

Folks,

I think I am struggling with what's supposed to be a simple problem.

Let's say I have a scene with a plane (used as ground) and a cube prefab. When I drag the prefab onto the scene, I see about 1/3 of the cube is hidden from the view because the bottom of the cube is sitting below the plane level.

So, I simply moved the cube up along the Y-axis until I am satisfied with the position, and dragged the cube GameObject (with updated Y-position value) from the Hierarchy window into the initial cube prefab in the Project window. To my knowledge, that should update the Y-position value of the prefab so that all subsequent initialization of the prefab would yield the desired positioning of the cube GameObject. But, it doesn't seem to be the case. The Inspector window shows the updated Y-position value but when I drag the prefab back onto the scene, the positioning of the object is same as before.

Can someone please tell me what I'm missing here? Thanks!

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by CrucibleLab · Nov 09, 2012 at 04:19 PM

I found the solution to my own problem and I just want to add it here for other users who might find themselves in a similar situation:

First off, thanks to astorga for taking time to kindly answer my newbie queries. It's been very helpful.

When you create a prefab out of an object, (I think) it normally creates a hierarchy - the actual prefab is the parent and under it there would be things like lighting, camera, and the actual object itself. The trick is to modify the values (whether it be position, rotation, or scale) for the object mesh rather than the values for the prefab.

Knowing what I know now, the Unity Doc makes clear sense but I wasn't sure how to apply that knowledge to actually dealing with the specific problem. I'd think that's probably because I am a beginner with Unity. So, this is for all the beginners out there!

Comment
Add comment · Share
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
0

Answer by astorga · Nov 08, 2012 at 01:26 PM

Have you tried to drag the GameObject to Hierarchy list instead of scene view?

Edit: looks like this is the only property that's not applied in prefab instances: "Note that the root's position and rotation will not be applied, as that affects the instances absolute position and would put all instances in the same place." (http://docs.unity3d.com/Documentation/Manual/Prefabs.html)

Comment
Add comment · Show 4 · Share
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 CrucibleLab · Nov 08, 2012 at 01:49 PM 0
Share

@astorga - Are you saying I should drag the Prefab onto the Hierarchy window? If so, I tried that too, but it didn't do the trick. Thanks though.

avatar image astorga · Nov 08, 2012 at 02:02 PM 0
Share

Looking the docs, looks like this property isn't applied to prefab instances. Check my answer, I've edited it.

avatar image CrucibleLab · Nov 09, 2012 at 12:03 AM 0
Share

Hey, thanks for the pointer. So, I understand the position and rotation properties are not applied. Anyway, the following statement from Unity Docs still confuses me:

"However position and rotation from any children or ancestors of the root will be applied as they are computed relative to the root's transform."

"children or ancestors of the root..."? I am lost. :(

avatar image astorga · Nov 09, 2012 at 03:25 AM 0
Share

A prefab can contain children GameObjects. These objects preserve position relative to the parent object.

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

10 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

Related Questions

GameObject change Position after game started 1 Answer

Creating a GameObject between two 3 Answers

How to add an asset to a script-enabled public game object? 1 Answer

How can I reference in a prefab's script a gameObject found in the scene 1 Answer

GameObject won't move to Transform Position 0 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