- Home /
I want to make objects invisible but interactive with input!
Hey, I recently found a way to move my player (Which is just a cube in the mean time!) through clickable nodes. I set nodes in a separate layer so I can hide it from renderer, but then all the functionality is gone!
I want to make the custom nodes invincible, but interactive, I also don't want to reduce performance by disabling the mesh renderer of the objects using script, cause the game will be on mobile devices.
Can you post your code. Any solution will likely depend on how the objects are meant to interact. Which we don;t know without your code.
It's just a very simple On$$anonymous$$ouseDown() method on the custom nodes. It's no big deal, but I want the colliders only to be there without the mesh.
void On$$anonymous$$ouseDown () {
Debug.Log ("Clicked!");
player.position = Vector3.$$anonymous$$oveTowards (player.position, parentCube.position, PathLength();
}
Answer by SuhailAlhegry · Jul 11, 2017 at 04:04 PM
Thank you all, but I found the solution. I just added a script to disable all mesh renderers in the scene under the tagged objects (Which in this case are "Nodes") in Awake(), and added a loading screen to hide that operation.
Answer by webcam · Jul 10, 2017 at 08:33 PM
Can you just remove the mesh renderer all together? Sounds like all you need is the collider for the click event.
I already thought of that, but doesn't it reduce performance?. also removing mesh renderer will hide the nodes in the editor! I want a solution that shows them in editor but not in renderer.
Answer by toddisarockstar · Jul 11, 2017 at 01:32 PM
//if you dont want to do this:
transform.renderer.enabled = false;
//you can do this instead:
transform.renderer.material.shader=Shader.Find("Transparent/Diffuse");
transform.renderer.material.color = Color.clear;
Your answer
Follow this Question
Related Questions
Sortlayer Renderer Extension 1 Answer
Clickable empty GameObject in the editor 3 Answers
Check if Layer is hidden or locked in editor 0 Answers
Change editor to use Z-axis as vertical 2 Answers