Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 pandasarebest · Sep 05, 2016 at 06:21 PM · c#instantiateprefabcoordinatesinstantiate prefab

My objects instantiate at a strange z coordinate

I am instantiating a prefab which contains the word "GAME". I have created the prefab so that its position is (0,400,0).

When I instantiate it using:

 GameText = Instantiate(Resources.Load("GameOver1"), new Vector3 (gameX, gameY, gameZ), Quaternion.Identity) as GameObject;

It spawns the object at the correct x and y coordinates, but at a Z of -997. The vector that is shown in the instantiation is new Vector3(0,350,1).

Because of this strange result I have tried changing what I instantiate, as well as instantiating it from the scene rather than the resource folder, but I still have no luck.

I then want to transform it to a new position over time, which appears to work as a scaled version of what I want, and funnily enough that scale is 997 times larger than I want.

On the plus side this is better than it used to be where it would spawn at random x,y and z coordinates.

Let me know if there are any attachements that would be useful to troubleshoot this problem.

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 tanoshimi · Sep 05, 2016 at 06:23 PM 0
Share

Please add the following immediately before your instantiate line. What does it print?

 Debug.Log("X:" + gameX + ", Y:" + gameY + ", Z:" + gameZ);
avatar image pandasarebest tanoshimi · Sep 05, 2016 at 09:27 PM 0
Share

Debug log shows x = 0, y = 352, and z =1 which is what it should be, yet it still instantiates at z = -997 :/

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Destroying assets is not permitted to avoid data loss. 0 Answers

Instantiation in C# 1 Answer

Instantiate prefab once help C# 1 Answer

Help with instantiating a prefab 1 Answer

How do I re-instantiate an object after it is destroyed from the scene? 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