Quantcast
Channel: Questions in topic: "renderer.enabled"
Viewing all articles
Browse latest Browse all 99

renderer.enabled working on PC but not android?

$
0
0
This is confusing me, I'm not quite sure what's going on. I'm trying to enable/disable the renderers of a set of child gameObjects. Testing it in the editor, it works perfectly. When I build it out and try it on my tablet, it doesn't work at all. All of my test variables behave as expected, except one: whichObject.transform.GetChild(0).renderer.enabled returns 'false' every time on android, regardless of the state of the game object. Anyone know why? if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began){ Ray ray = guiCamera.ScreenPointToRay(Input.GetTouch (0).position); RaycastHit hit; if(Physics.Raycast (ray, out hit, guiLayerMask)){ testButton = "Hit Button: "+hit.collider.transform.parent.name; WhichButtonPressed(hit.collider.transform.parent.name); } } Skipping down to the relevant bit: case "removeExtWalls" : testButton = "removeExtWalls"; //To make sure I'm actually presssing the building whichObject = GameObject.FindWithTag("extWalls"); turnOn = !whichObject.transform.GetChild(0).renderer.enabled; testObject = whichObject.name; testButtonStatus = whichObject.transform.GetChild(0).renderer.enabled.ToString(); //Always returns 'true' on android, changes as expected in editor foreach(Transform subObject in whichObject.transform){ subObject.renderer.enabled = false; } break;

Viewing all articles
Browse latest Browse all 99

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>