- Home /
Question by
boorn · Jan 26, 2015 at 09:26 AM ·
c#instantiate2d-platformer
Can't move instantiated 2d game oject.
Hello guys! Stuck in problem trying to make simple 2d shooter. Here is a Fire spell script:
if (Input.GetKeyDown(KeyCode.Space) && CanSpell && facingRight)
{
GameObject SpellClone = Instantiate(spellObject, spellSpawnPoint.transform.position, Quaternion.identity) as GameObject;
SpellClone.transform.position += new Vector3 (SpellSpeed * Time.deltaTime,0.0f , 0.0f);
}
Unity runs it well without any errors but then I'm trying to fire the game pauses. Whats wrong? All proper game objects are selected in inspector.
Comment
Is SpellObject particularly intensive? Consider pre-instantiation and object pooling.
Does it add a lot of time to the main thread in the stats dropdown? Does it take a lot of processing?