Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by frossdelaqrois · Jul 10, 2012 at 08:45 PM · error

Cannot fix error anyone have any suggestions

 error CS1525: Unexpected symbol `{' 
 line 59 is marked with double star **
 
 
 using UnityEngine;
 using System.Collections;
 
 public class TP_Camera : MonoBehaviour 
 {
  public static TP_Camera Instance;
  
  public Transform TargetLookAt;
  public float Distance = 5f;
  public float DistanceMin = 3f;
  public float DistanceMax = 10f;
  public float X_MouseSensitivity = 5f;
  public float Y_MouseSensitivity = 5f;
  public float MouseWheelSensitivity = 5f;
  public float Y_MinLimit = -40f;
  public float Y_MaxLimit = 80f;
  
  
  private float mouseX = 0f;
  private float mouseY = 0f;
  private float startDistance = 0f;
  private float desiredDistance = 0f;
  
  void Awake()
  {
  Instance = this;
  }
  
  void Start () 
  {
  Distance = Mathf.Clamp(Distance, DistanceMin, DistanceMax);
  startDistance = Distance;
  Reset();
  }
  void LateUpdate () 
  {
  if (TargetLookAt == null)
  return;
  
  HandlePlayerInput();
  
  CalcuateDesiredPosition();
  
  UpdatePosition();
  }
  void HandlePlayerInput()
  {
  var deadZone = 0.1f;
  if (Input.GetMouseButton(1))
  {
  // The RMB is down get mouse Axis input
  mouseX += Input.GetAxis("Mouse X") *X_MouseSensitivity;
  mouseY -= Input.GetAxis("Mouse Y") *Y_MouseSensitivity;
  }
  
  // This is where we will limit mouseY
  
  if (Input.GetAxis("Mouse ScrollWheel") < -deadZone || (Input.GetAxis("Mouse ScrollWheel") > deadZone)
  {
  desiredDistance = Mathf.Clamp(Distance - Input.GetAxis("Mouse ScrollWheel") * MouseWheelSensitivity, DistanceMin, DistanceMax);
  }                      (** THIS LINE)
  }
  void CalcuateDesiredPosition()
  {
  
  }
  void UpdatePosition()
  {
  
  }
  public void Reset()
  {
  mouseX = 0;
  mouseY = 10;
  Distance = startDistance;
  desiredDistance = Distance;
  }
  public static void UseExistingOrCreateNewMainCamera()
  {
      GameObject tempCamera;
  GameObject targetLookAt;
  TP_Camera myCamera;
  
  if (Camera.mainCamera != null)
  {
  tempCamera = Camera.mainCamera.gameObject;
  }
  else
  {
      tempCamera = new GameObject("Main Camera");
  tempCamera.AddComponent("Camera");
  tempCamera.tag = "MainCamera";
  }
  
  tempCamera.AddComponent("TP_Camera");
  myCamera = tempCamera.GetComponent("TP_Camera") as TP_Camera;
  
  targetLookAt = GameObject.Find("targetLookAt") as GameObject;
  
  if (targetLookAt == null)
  {
  targetLookAt = new GameObject("targetLootAt");
  targetLookAt.transform.position = Vector3.zero;
  }
  
  myCamera.TargetLookAt = targetLookAt.transform;
  
  }
 }
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image AlucardJay · Jul 11, 2012 at 12:28 AM 0
Share

looks like the 3D Buzz tutorial =]

Unfortunately it is very hard to read this without the code being formatted. But the method HandlePlayerInput seems fine? except for the spelling of $$anonymous$$ouse ScrollWheel (note : scroll , not scrool) =]

Please edit your answer, by highlighting all the code, then click the '10101' button at the top. Then it will be much easier to read, and a better chance for you to get an answer.

What section/video is this from (where are you up to)?

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by DaveA · Jul 11, 2012 at 12:35 AM

You need to format this, but that error almost always means a mis-matched set of { } so make sure those all match up. If you use MonoDevelop, it highlights the matching one if you click on it, and/or use Ctrl-B to jump to match. If it jumps somewhere you don't expect, you are on track to finding the problem.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image frossdelaqrois · Jul 11, 2012 at 12:08 PM 0
Share

Thanks solved problem now ^_^

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Ending my game 3 Answers

Error BCE0018 0 Answers

Need Help Understanding Script! (Javascript) 1 Answer

need help, with greater than statment 1 Answer

Error in script 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges