- Home /
Question by
Fluffy_Duckerman · Jul 24, 2018 at 02:33 AM ·
instantiateinstantiate prefabtransform.translate
transform.Translate code isn't working
Hi guys,
I've attached the following code to a GameObject I'm instantiating with an empty GameObject. The transform.Translate aspect of the code is unsuccsessfully moving the object. I've observed the following:
1) When paused, and I move the object manually, then unpause, it returns to its original position.
2) Similar objects with this code work just fine.
3) The TimeChanger aspect of this code doesn't affect anything.
4) If an instance is placed in the editor without being instantiated, same problem.
5) I've tried it parented and unparented, same problem.
6) When an identical object is placed in a new project, it moves just fine.
As you can imagine, this is a bit of a head scratcher. I've exhausted my options and now I look to you.
public float speed;
public bool orientation;
void Update ()
{
transform.Translate(0, -speed * Time.deltaTime, 0);
if (TimeChanger.pause)
{
GetComponent<AudioSource>().mute = true;
}
else GetComponent<AudioSource>().mute = false;
}
Comment