I’m working on a V3 project and building to the iPhone and iPad. But, I have three objects that appear sometimes yet disappear other times. It doesn’t seem to matter and I have no special scripts that are turning the objects on or off.
Any ideas why objects would disappear randomly? To fix it I have to delete everything (projects, executables, etc.) and redeploy.
Has anyone else witnessed this?
Are there any particular shader or textures you are using with these objects or is there anything particularly distinctive about their meshes?
Here’s what I figured out.
I am setting the starting position of the object in the Start() function and then in update I keep it on a starting axis (to keep it from moving on one axis.)
It turns out that it was calling Update() before it had a chance to call Start(). I moved my code to the Awake() function and it works now…
I’ve noticed some strange behavior with timing and Unity 3 lately and this is just another example. Or does Start() not always get called before the first Update()?
The Start function should definitely be called before the first Update. Can you post the code that is causing the trouble? It could be a bug in the beta version, but it would be worth checking the script before reporting it.
private var StartY:float;
Start()
{
StartY = transform.position.y;
}
ResetMe()
{
transform.position.y = StartY;
}
The case may be off but that’s what the code (was) doing. I now have the setup in the Awake() function. Basically I call the ResetMe() function when I’m done with the object in the scene.