Original title: can someone make a script on it in java
i want to know the script which do this thing
if body1 touches body2 than body1.visible=false
I've changed the title to be useful for someone looking for a solution to the same problem and added the relevant tags. I won't write the code for you but in the answer, you're getting everything you need to write the code for yourself, which ... btw ... will be much more rewarding than copy'n'pasting someone else's code ;-)
Thanks for changing the title
Answer by jashan
Jul 20, 2010 at 03:58 PM
B) What you are looking for is this:
i want to invisible that object which i want
i learnt the basics of the java
As I've written in my answer, under B - you can user render.enabled = false to make the object invisible. The renderer makes the object visible - and when the renderer is disabled, the object is invisible. Might not be totally intuitive if you're just starting but makes a lot of sense if you have a bit of a deeper understanding of how Unity uses game objects and components.
Regarding the "basics of java": There is no Java in Unity. If you know Java (the programming language and framework developed by Sun Microsystems), I recommend learning C# because it's very similar to Java.
now i know that how i do it by using trigger
Great ... if you feel the answer is valuable and correct, you may consider "accepting" it by clicking on the little "check" icon next to the "score" (which currently says "3"). That will help people see that the question has an accepted answer.
Answer by Panamamigo
Jul 20, 2010 at 04:28 PM
why don't you just set the renderer.enabled= false;? That will make Unity forget about rendering that object and it will be invisible, un-interactive, un-responisve, etc. It'll be like it never existed until you reset the renderer.enabled to true again. So write the code, but if what I illustrated is what you are looking for then you at least have a hint of where to start.
It'll still be interactive, responsive, and whatever else. It just stops rendering it is all, the collider and scripts will still work the same
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
No one has followed this question yet.
Makeing something Blow-up
How to enable/disable "Is Trigger" on collision enter ?
Renderer on object disabled after level reload
Damage on collision
Invisible barrier transform.Translate error