- Home /
Having problems spawning an object via script c#
I'm having problems spawning in an game object via c# scripting. I'm sill quite new, and therefor I can't make out what I've done wrong.
using UnityEngine;
using System.Collections;
public class EnemySpawn : MonoBehaviour {
public Rigidbody Tank0;
void update ()
{
if (Input.GetKey(KeyCode.Alpha1))
{
Instantiate(Tank0, transform.position, transform.rotation);
}
}
}
Thank you for your time (=
Answer by tanoshimi · Jul 11, 2015 at 06:59 AM
When asking for help, please state what you did, what you were expecting to happen, and what actually happens.
I'm guessing in your case you attached the script above to a gameobject in the scene, expected to Instantiate a tank when you press the 1 key above the keyboard, but nothing happens. No error is generated. Right?
Line 8: update should be Update.
Your answer
Follow this Question
Related Questions
Help with getting a bool from another script 2 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Restricting movement with Mathf.Clamp 4 Answers
Script will be found on the client but not on the server. 0 Answers