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 beavisCZ · Mar 30, 2012 at 05:24 PM · prefabinstantiation

Instantiated PreFab selection problem

Hello, I use scripted gameobject generation in UnityEditor like this: GameObject temp = (GameObject)AssetDatabase.LoadAssetAtPath("Assets/media/tiles/Tile.prefab", typeof(GameObject)); GameObject go = (GameObject)GameObject.Instantiate(temp);

It works fine, I'm able to generate many those objects. But I have one problem. This prefab has several child objects in it. Tile.prefab -objectA -objectB -objectC

If I click on this Instantiated object in unity editor it select one of child objects. But if I put same prefab into scene by drag and drop instead of script, when I click on it, it is selected as whole.

Is some solution to fix this problem?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by rutter · Mar 30, 2012 at 06:57 PM

That's pretty typical for the editor, actually. When clicking on objects in the scene view, the editor will try to figure out which specific object you clicked on -- for example, if you click on a particular mesh which happens to be attached to some object which is a child of your prefab, you'll probably get that child object selected rather than the prefab itself.

I'm not sure if there's a good way around that. I suppose you could look for an editor hotkey to select something's parent object -- or code up your own.

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 beavisCZ · Apr 02, 2012 at 06:54 AM 0
Share

But if I put same prefab from project folder to scene, it gets blue color (I think it means it maintain link to prefab) and when I click on it, it is selected as whole. If I use scripted method, it gets black color in scene hierarchy. I dont know what I do different by script.

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

Help with Prefab script running on wrong instance... 0 Answers

Script is working incorrectly. (rotation) 1 Answer

How can I tell what prefabs a child object (script) is in? 2 Answers

What should a script contain? 1 Answer

Accessing instance of prefab from its own script 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