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 OmegaVemon · Nov 23, 2010 at 02:38 AM · transformpositionupdate

Transform position not changing.

I have a first person controller, which is the Player.

Anyway, in my scene there is only one GameObject which will Instantiate the player on the beginning of the game. I can control the player just fine, everything is fine.

However, after debugging a while, I am printing the player's position, and it never changes, even though I clearly move it around. The X position is always 4 (the X where I instantiated it)

Why?

Comment
Add comment · Show 7
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 Uriel_96 · Nov 23, 2010 at 03:13 AM 0
Share

Are you using Debug.Log(transform.position); or Debug.Log(transform.localPosition.x);???. Please, specify put your code or something like that.

avatar image skovacs1 · Nov 23, 2010 at 04:46 PM 0
Share

Do you ever move it on the x axis? Please post the code which you use to move your GameObject.

avatar image OmegaVemon · Nov 23, 2010 at 11:55 PM 0
Share

Ok, I have used playerObject.transform.localPosition and playerObject.transform.position to track the position of the playerObject, which is a variable linked to the player prefab. The game will Instantiate such prefab into the map. Yes, I do move the player, I mean, it is a first person controller, and I move it all around the map, but the values are the same (equal to the spot where the player was spawned)

avatar image jimjim · Nov 09, 2011 at 11:58 AM 0
Share

i have this too but my bot does update its position when i throw him about. if you have found a solution please let us know

avatar image Bunny83 · Nov 09, 2011 at 12:02 PM 0
Share

It's a really old question (almost a year) and it seems the OP has abandoned his question. Anyway, i think he's accessing the prefab ins$$anonymous$$d of the Instantiated object. If you have a variable that holds a prefab reference you would use it to instantiate one of these objects and Instantiate returns the reference to the new created instance. If you check the position of the prefab it will always stay the same.

@jimjim: without knowing the actual code and setup fo your scene It's just guessing. You should start a seperate question since this one seems to be dead. Also don't post comments as Answers....

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by idiot333 · Feb 26, 2015 at 08:11 PM

It is about Instantiating an object from another object. It's not about transform or anything. It will not work if your instance is not currently present in the scene. BE CAREFULL FROM WHERE YOU PROVIDE THE REFERENCE IN THE INSPECTOR.

if you provide reference(drag and drop the instance of the gameObject) from the HIERARCHY then it's gonna work fine because the object is not null null and is still present in the scene.

if you drag and drop from the prefab in order to provide reference to the gameobject then it will not work if the object not present in the scene ie reference is null.

NOTE: my answer might contain some mistakes as i just started in unity. But That is what worked for me.

Thanks

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
1

Answer by ercu · Apr 02, 2015 at 09:23 PM

If you change position on Awake it won't effect. Try changing position on Start.

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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

[2D] Get the position of an object outside the scope 2 Answers

Instantiating road pieces without any spacings between 2 Answers

Vector3.Lerp works outside of Update() 3 Answers

Obtaining the relative size of a Models body part 1 Answer

How to calculate the distance between specific side of an object and the closest to it surface's edge 1 Answer


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