- Home /
Error CS1519 Help
I want to call this code:
CBBinding.showInterstitial(null);
Into here:
using UnityEngine;
using System.Collections;
using Chartboost;
public class Menu2 : MonoBehaviour {
CBBinding.showInterstitial(null); //error
private Ray ray;
private RaycastHit rayCastHit;
void Update ()
{
if(Input.GetMouseButtonDown(0))
{
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray, out rayCastHit))
{
if (rayCastHit.transform.name == "PlayButton")
{
Application.LoadLevel("Main Game");
}
}
}
}
}
But i keep getting that error saying "unexpected symbol '(' in class,strut, or interface" If you can help thank you
Please give the entire error message when asking for help. It contains important debugging information, like on what like the error occurred.
As it happens however this is easy...
If you wish to access function showInterstitial() from CBBinding, you will need to instance it.
private CBBinding cBBinding;
Your class doesn't know what it is.
Answer by Jeff-Kesselman · May 31, 2014 at 03:35 PM
You cannot call code outside of a method.
If you want to call that code once, put it in a Start() method. Otherwise put it in your Update() method.
I did call it and i get more errors, such as a parsing error
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Null reference exception error in Unity, Please Help! 1 Answer
Built game error 0 Answers
Need help syntax error 1 Answer
I am having problems uploading my project to Xcode Can anyone help??? 0 Answers