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
1
Question by blober81 · Aug 15, 2016 at 04:09 PM · prefabrenderingchild objectresources.loadinvisible-object

instantiated child prefab invisible

Hi everyone,

When I load a prefab sprite using...

 GameObject g = Instantiate (Resources.Load ("Prefabs/" + unitName [0])) as GameObject;

...the child object is not rendered. When searching for answers there were many posts on this. However none of the solutions fixed my problem.

  • the instantiation is not done in Awake() so that can't be the problem.

  • The child prefab is not rotated during the instantiation.

  • I changed the sorting layer of both the parent and child prefab but the child remained invisble.

  • The order in layer of the parent prefab is 2 and the child is 3 so that should be OK as well.

  • In scene view I am able to click on the child prefab. So during instantiation it's placed in the right position and rotation.

  • When I manually drag the prefab into the scene it's displayed correctly.

Does anyone have a clue what could be the problem here ? Thanks so much for any help.

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 JoshDangIt · Aug 15, 2016 at 05:08 PM 0
Share

Have you checked to see if the prefab is instantiated in the right position? You'll have to set g.transform.position after instantiating if you didn't.

avatar image Isterisko · Feb 12, 2017 at 08:25 AM 0
Share

Same happening to me. Did you manage to solve it?

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by MurcsRoyce · Oct 11, 2017 at 05:13 AM

i just spent hour trying to solve this problem. and i finally got it.

for me this was the problem.

Step one : make sure your object is for sure in camera view. Step two: make sure your object is in front of background/ not on it not behind it. Step three: remake your prefab

and my objects are now instantiated and visible....

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
0

Answer by mbin828 · Apr 28, 2020 at 01:40 PM

@blober81 I know this is super late but I had the same exact problem and it was really frustrating. I'm surprised no one answered this question but this is how I solved it:

I put the spawn point under a sprite. You can leave the sprite field in the sprite renderer empty and it looks like a regular empty 2d point.

I was just trying random shit and have no idea why this works.

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
0

Answer by rxx1 · Feb 14, 2021 at 04:50 PM

This may be a bit late but I'll put this here for others who come across this thread

if the z position of the spawn point and the player are not both equal to 0 then it will spawn invisible

hope this fixes your problem :)

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Prefab not rendering when declaring Transform variable 1 Answer

Not a question - just some performance metrics for rendering from Unity scripts 0 Answers

Resources.Load() or Prefab manager? 1 Answer

How to get unique reference to instantiated prefab 1 Answer

Best practice instantiating objects from code 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