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 Guwang · Nov 09, 2017 at 12:08 AM · transformsceneprimitives

Problem when manually creating game object in scene

Hello, I encountered this weird problem with unity when manually creating GameObjects in game scene. I am working on a 2D game, and have been working on this project for quite a while. Recently, when I right click in the hierarchy and create a primitive game object, such as a quad or a sprite, it automatically sets its z-position to -10. This is really annoying because this disrupts the order of objects and I have to manually set it back to 0. However, when I drag an imported sprite into the scene, its z-position is not set to -10 automatically. I have no idea how to fix this problem, so I hope someone can point out the issue for me. Thank you.

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

3 Replies

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

Answer by henrimh · Nov 09, 2017 at 09:13 AM

I think it depends on what you have previously selected in the hierarchy, or where your camera is pointing in scene view (if viewing the scene in 3D). Try selecting different objects and then create stuff or move the scene view camera around.

Comment
Add comment · Show 3 · 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 Guwang · Nov 09, 2017 at 12:30 PM 0
Share

$$anonymous$$y scene view is 2D, and I have not selected any objects in the hierarchy before I create a new game object. I have been having this problem for a couple of days and have been messing around with camera, scene view, etc. Apparently nothing solves the problem. However, this problem only happens in this particular project, so I guess I have accidentally changed something without noticing.

avatar image Guwang · Nov 09, 2017 at 05:14 PM 0
Share

I figured it out. It is the camera positioned in the scene. I thought camera position in the scene does not matter in 2D view, but apparently it does. I focused back to zero position and everything works fine. Thank you for your answer.

avatar image henrimh · Nov 09, 2017 at 08:55 PM 0
Share

Glad you figured it out!

avatar image
0

Answer by Daemonhahn · Nov 09, 2017 at 12:35 PM

Unity does this by default as the default camera position is 0,0,0 so this would make the objects you place, viewable.

If you would like to change this, write an editor script that adds your own create functions to the list in the create menu. This is very easy to do:

https://docs.unity3d.com/ScriptReference/MenuItem.html

would be needed to make the class accessible from the menu,

after that just have it instantiate the object, and place it at 000 or wherever you want.

And there you have it, you'll have a custom hierarchy pipeline!

Comment
Add comment · Show 1 · 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 Guwang · Nov 09, 2017 at 05:16 PM 0
Share

Sorry, Daemonhahn, I did not mark you answer as the best one, but I still appreciate you help very much. You did provide a very good alternative solution for the problem. Thank you again.

avatar image
0

Answer by Guwang · Nov 09, 2017 at 12:47 PM

First of all, thank you for your help. I understand that I can use a custom editor to get rid of the problem, but even when I create a new camera in scene, its z-position is set to -10 automatically. On top of that, I have not had this problem before in the same project. This problem showed up just a couple days ago. In the past, I was able to create an primitive or empty game object or camera that would not go to -10 z automatically.

Comment
Add comment · Show 6 · 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 Daemonhahn · Nov 09, 2017 at 12:53 PM 0
Share

Right but once you've made the new camera, use your custom editor to set its position to 000 like I said?

That's why you use the editor, so that after adding an item you can override its positon and position it where you like.

avatar image Guwang Daemonhahn · Nov 09, 2017 at 01:04 PM 0
Share

I am not so familiar with unity editor, so I only know how to create a custom game object using unity editor, but how can I reset the transform of a primitive using editor?

avatar image Daemonhahn Guwang · Nov 09, 2017 at 01:07 PM 0
Share

What?

I am confused.

The same way you would for anything?

transform.positon = new Vector3(0,0,0);

Do that after instantiating it.

I'm not sure you understand, let me elaborate:

$$anonymous$$ake a custom editor script that has a menu item attribute at the top called something like "Assets>Create>centredCamera" so you can access it from a sensible menu.

Inside that menu item method, have it instantiate a camera and then set its position to 0 0 0.

If you struggle with editor stuff, look at https://docs.unity3d.com/ScriptReference/ScriptableWizard.html for an easy to make editor.

Show more comments

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

98 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

Related Questions

Changing the player's starting position depending on the scene transition. 1 Answer

How to move the world/scene not the player - or not? 1 Answer

Unity 3d(Space) Questions 1 Answer

Simple Networking Question 0 Answers

Transform.GetScene in profiler 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