- Home /
Parsing Error(newObjRight)
So I was coding a multishot projectile in the form of a 2d missile. Ideally I want two missiles side by side to fire forward on the plane. I have not yet saved the code because I noticed there would be a parsing error (newObjRight and +=). I would like to know if anyone has any ideas on how to solve this. Also I believe the error is only in the Projectile2 script and not anywhere else. Thanks ahead of time!
using UnityEngine;
using System.Collections;
public class Projectile2 : MonoBehaviour {
// Used to control how fast the game object moves
public float MoveSpeed = 7.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.position +=
transform.up * Time.deltaTime * MoveSpeed;
}
public void FireMultiShotSideBySide();
{
//Right
Projectile2 newObjRight = Instantiate (Projectile2, transform.position, transform.rotation) as Projectile2
newObjRight.transform.position += newObjRight.transorm.right * 1.0f
//Left
Projectile2 newObjLeft = Instantiate (Projectile2, transform.position, transform.rotation) as Projectile2
newObjLeft.transform.position += newObjLeft.transorm.left * 1.0f
}
}
Answer by Mmmpies · Mar 08, 2015 at 02:27 PM
Where do I start :¬)
You've got a semi colon at the end of line 21 which is wrong, no semi colon at the end of 24, 25, 28 and 29. You misspelled transform on line 25 and 29.
Pretty sure you should have a
public GameObject projectile2; // NOTE LOWERCASE P
at the top and change
Instantiate (Projectile2,
to
Instantiate (projectile2,
and change the other references to Projectile2 to the word GameObject.
Other than that transform.left doesn't exist but you could try just using transform.right with -= instead of +=
PS not getting email notifications so will not get notified if you comment but will try and look in on this in a few hours.
Your answer
Follow this Question
Related Questions
Unity stealth tutorial script problem 1 Answer
I need help with a max.x parser error -2 Answers
Parsing Error 2 Answers
Messed up script 0 Answers
Keystore causes parsing error 0 Answers