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 ateares · Oct 18, 2017 at 09:41 PM · gameobjectscenevisible

Instantiated Child objects don't appear in Game, but visible in scene

Hi, in my game project I'm facing an issue where the 'health bar' sprite object is appear on some objects and not on others. This is what I've done already...


I've attached my 'health bar' sprite to another sprite prefab as a child, configured the behavior and tested it. It worked fine (life goes down when attacked).


  • When I place the unit object prefab in the scene, everything renders properly and behaves as expected. You can see in the image below three different colored beetles facing upwards with health bars.

  • When I instantiate the prefab randomly (as my enemy) it also appears and behaves properly.

  • When I instantiate the prefab for the player on mouse click, the object is created as expected... but as you can see below, the 'health bar' is visible in the scene and not the game.


I've tried comparing Z values; changing rendering- layers, order, texture; camera settings; and the code for instantiating the prefabs for enemy and player are the same as well.


Not sure what else to try.

alt text

untitled.jpg (208.4 kB)
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

2 Replies

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

Answer by lipemon1 · Oct 18, 2017 at 10:14 PM

My first suggestion is to check the order number on your sprites.


Sprite Component example


If that don't solve your problem check your Camera. It can be not rendering everything. Check your Culling Mask option. Select " Everything" to do a quick test.

Also on your Camera component, check the values of your Clipping Planes. It can be cutting part of your objects.


alt text


Hope that solve your problem.


screen-shot-10-18-17-at-0756-pm.png (19.2 kB)
screen-shot-10-18-17-at-0801-pm.png (22.0 kB)
Comment
Add comment · Show 2 · 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 ateares · Oct 19, 2017 at 11:44 PM 1
Share

I've tested just about everything you've listed. Finally got it to work by changing the near clipping plane on the camera to 0.

It's weird that I've got this issue with the clipping plane on player objects and not for the enemy objects. But in any case, it was due to the clipping plane... I won't worry about how it became an issue for now.

Thanks for the suggestions!

avatar image mauricio_andrian ateares · Oct 13, 2020 at 11:36 PM 1
Share

Thanks! This was exactly my problem. "Clipping Panes Near" was 0.3. I set it to 0 and everything worked.

avatar image
0

Answer by burak11581999 · Mar 14, 2021 at 07:57 PM

Guys, if that not solve your problem, you can change the camera projection from perspective to orthographic. That solved my 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

113 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

Related Questions

Instantiated GameObject Not Rendering 1 Answer

Add mesh with materials to scene through code. 0 Answers

When ai (capsule) touches gameobject reset scene. The code does not work, and there is no errors any suggestions 1 Answer

How to access a game object from a different scene? 0 Answers

How do I play gameobjects in my scene from one script / Script is not working 0 Answers


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