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 GreatCorn · Aug 07, 2018 at 01:23 PM · bugvector3scene-switchingglobaltransform.forward

transform.forward breaks when changing scenes

So I managed to get transform.forward to work, but when I build the game and change the scene to the needed one (takes about 3 scene changes) transform.forward starts working like Vector3.forward. In the editor, when starting the game on the needed scene everything is alright. Why is that so?

Edit: More details, as you ask. I have tried modifying a script in the built game using dnSpy some time before that used transform.forward to move the Player. When switching the scene from one to the another needed one transform.forward would also become broken. I don't know any other possible details, besides listing every single object in the scene and every used script possible.

Comment
Add comment · Show 6
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 JedBeryll · Aug 07, 2018 at 02:26 PM 0
Share

Are you sure you are calling it on an instance and not a prefab reference? Anyway, the transform.forward will return the same value as Vector3.forward if the object's euler angles are (0, 0, 0) in world space.

avatar image GreatCorn JedBeryll · Aug 08, 2018 at 03:18 AM 0
Share

The script gets the forward of the object it's on (and it works absolutely fine in the editor when starting the game from the scene with the object and the script) and the object is the player that rotates a lot. What did you mean by calling on a prefab instance and an object instance?

avatar image JedBeryll JedBeryll · Aug 08, 2018 at 04:12 AM 0
Share

Let's say you have a reference like this: public GameObject whatever;. You can assign a scene object (instance) or an asset in the assets folder (prefab) to this variable. So if you call whatever.transform.forward, you could be calling this on a prefab.

avatar image GreatCorn JedBeryll · Aug 08, 2018 at 07:56 AM 0
Share

The script was assigned to the Player gameObject and it couldn't be executed if it was a prefab, also it was working perfectly fine(not in the build), as I said. Sorry, I kinda misunderstood your point

avatar image Bunny83 · Aug 08, 2018 at 08:47 AM 0
Share

Sorry but your first question was as unspecific as this one. Also your answer on your other question is also pretty pointless. Your conclusion makes no sense. Searching for an object works pretty well as long as you know what you're searching for and as long as there are no ambiguous objects in the scene. In neither question have you included your actual code used or any hint what objects are involved or how your hierarchy looks like.


If you're expecting any answers from us you have to include way more details in your question. Usually we would just close questions like that since it can't be answered as it's too unspecific.


So please edit your question and add more details.

avatar image GreatCorn Bunny83 · Aug 08, 2018 at 11:54 AM 0
Share

Gee. Should I give a link to a 6+ GB project? There is not much of a script, just simply getting the transform.forward. I could include anything that would be related to the issue if I knew what could be. And the answer for my previous question has helped me and everything worked fine(except for this scene thing) after that. I also could and may be asking for any possible reasons and causes, that I could have missed.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by GreatCorn · Aug 09, 2018 at 07:36 AM

Turns out I have better luck talking to a wall than getting any possible answers, ideas or solutions. As always figuring everything by myself. Getting the transform.forward in LateUpdate() fixed the error for me, as I also additionally called LateUpdate() manually from Start() and Awake(). Thanks for some attention, at least, that's rare..

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

120 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 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

Is there any way to translate normalized vectors into angles? 1 Answer

how to get local "up" in global space? 1 Answer

Make a object move forwards 1 Answer

transform.forward doesn't correspond to rotation 1 Answer

transform.forward wobbles about instead of rolling 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