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 anurooppv · Dec 09, 2014 at 07:58 AM ·

How to remove certain parts of an object?

Attached are the actual game scene & the game scene I am currently developing. As you can see, the obstacles are created by instantiating & randomly positioning them. Parts of the obstacles are hidden behind the top part & scene. I am using second camera to show the preview/timeline of the game(top right-hand side). As you can see, it is different from the actual game scene. The hidden obstacle parts are visible in the preview. Is it possible for me to remove them? Please help.alt text

1.jpg (275.2 kB)
myscene.png (148.7 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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Andres-Fernandez · Dec 09, 2014 at 07:59 AM

You can disable their renderer component and then use OnBecameVisible to enable their renderer again.

Comment
Add comment · Show 7 · 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 anurooppv · Dec 09, 2014 at 08:03 AM 0
Share

Thanks for the reply. $$anonymous$$y doubt is: the obstacle is made of 4 square elements. I am randomly arranging them to create the attached game scene. So how do I perform the method you have suggested? Could you please elaborate?

avatar image Andres-Fernandez · Dec 09, 2014 at 08:16 AM 0
Share

It depends on how you want your objects to appear (the whole obstacle at once or each square element at a time).

If you want each square element to appear as soon as it's visible by any camera, just attach a script to the square prefab with a reference to its renderer and use the OnBecameVisible function to enable it.

If you want the whole obstacle to appear at once (i.e. the 4 square elements) then attach a script to the parent object (the obstacle) and store a reference to the 4 children renderers. Then use the OnBecameVisible function to enable those 4 renderer references.

avatar image CHPedersen · Dec 09, 2014 at 08:22 AM 0
Share

I think something is unclear here, which could complicate matters a little: Do the 4 squares constitute one textured gameobject, (one mesh / sprite), and you're shifting that whole thing up and down, or do you have one individual gameobject per gray square, and you're shifting each vertical collection of 4 individual gameobjects up and down?

Andres Fernandez' suggestion is based on the understanding that you've got 4 individual gameobjects per obstacle.

avatar image anurooppv · Dec 09, 2014 at 08:39 AM 0
Share

Spot on CHPedersen.. I have only 1 gameobject per obstacle. I am attaching the image. I am randomly moving it up & down to create the obstacles. Hence I am not sure how to remove the hidden parts of the obstacles in the game preview shown by the second camera..alt text

blockof4.png (6.7 kB)
avatar image Andres-Fernandez · Dec 09, 2014 at 08:44 AM 0
Share

Oh, sure, you're right. As you wrote "randomly arranging them" I immediately thought of Tetris-like pieces made of 4 individual sprites.

So yeah, my answer is completely useless. Feel free to downvote it, discard it or completely forget about it.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Weird bug i encountered with 2 screens. Any help? 1 Answer

Multiple cameras in game scene to create preview of the game 0 Answers

2 sound for one object on press of diffrent buttons. 1 Answer

Ball travelling in wrong path after collision 0 Answers

How to set fire ???? 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