Script For Teleporting Main Camera
I tried my best at writing a script for Unity in C# below, and was going to attach this to a button marked, "HELP" so when the player presses the "HELP" button it directs the camera offscreen to the help menu. The only problem is... well the script does not work, could any of you guys help me? 2 errors come up when this script is saved, Error #1 -Assets/Scripts/HELPscript.cs(6,40): error CS1519: Unexpected symbol =' in class, struct, or interface member declaration & Error #2 - Assets/Scripts/HELPscript.cs(6,55): error CS1519: Unexpected symbol
5' in class, struct, or interface member declaration . If any of you could possibly fix the script or just point out how to fix it, it would be greatly appreciated! <3 Thanks!
using UnityEngine; using System.Collections;
public class HELPscript : MonoBehaviour {
Camera.main.transform.position = new Vector3(5, 5f, -10);
}
Answer by twinnuke · Aug 15, 2016 at 11:18 PM
I'm not sure that's your problem. Check the code around the area.
Your answer
![](https://koobas.hobune.stream/wayback/20220612090907im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Scene is a black screen when game is built 0 Answers
is this a bug? parented camera origin changing parent origin 0 Answers
Select game objects with RectilePointer 0 Answers
Post Process Layer not working on Main Camera 2 Answers
Unity 5.3.1f1 Objects destroying on apk build but not in the editor 1 Answer