When I run game in Unity3D editor on my laptop it will let me flip objects between active and inactive, but when I run the same game on Xbox One I can set GameObjects to be inactive but then it won’t let me set them to active again. I think it might be destroying the objects when I set to Inactive. Any Suggestions on how to handle or if that is correct understanding of problem. (I guess I could spawn the objects when I need them, but seems wastful)
Can you show us the snippet of code you use? And are you using unityscript or c#?
Here is the function that I am using which works on dev laptop but not Xbox.
Is a C# script.
private void checkIfSwitchCharacters()
{
var inputDevice = InputManager.ActiveDevice;
if ((inputDevice.LeftTrigger.WasPressed) || (inputDevice.RightTrigger.WasPressed))
{
currentCharacterArrayPosition = currentCharacterArrayPosition + 1;
if (currentCharacterArrayPosition >= 2)
{
currentCharacterArrayPosition = 0;
}
currentCharacterGameObject.SetActive( false);
playerAnimator = charactersAnimators[currentCharacterArrayPosition];
currentCharacterGameObject = charactersGameObjects[currentCharacterArrayPosition];
currentCharacterGameObject.SetActive(true);
}
}
XBOX supports setActive. I’m 100% certain what your problem is. The Unity Editor and other deployments do not give you the same order of GameObjects when you are retrieving them from your scene in your code. For example, if you have more than 1 object with the same tag and you get all the objects by tag, on your computer you could get object1, object2, and object3 and on the XBOX, you could get object3, object1, object2.
Good Luck!