Question by
madman_118 · Aug 26, 2015 at 11:35 PM ·
unity5assetsmonodeveloperror-cs1525
Hi im getting this error in my script Assets/MouseManager.cs(11,27): error CS1525: Unexpected symbol `Vector3'
using UnityEngine; using System.Collections;
public class MouseManager : MonoBehaviour {
void Update() {
if( Input.GetMouseButtonDown (0)
// We clicked, but on what?
Vector3 mouseWorldPos3D = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector2 mousePos2D = new Vector2(Input.mouseWorldPos3D.x, Input.mouseWorldPos3D.y);
Vector2 dir = Vector2.zero;
RaycastHit2D hit = Physics2D.Raycast (mousePos2D, dir);
if(hit != null && hit.collider!=null) {
// We clicked on SOMETHING that has a collider
if(hit.collider.rigidbody2D !=null) {
hit.collider.rigidbody2D.gravityScale = 1;
}
}
}
}
Comment
Answer by Wolfshadow · Aug 27, 2015 at 12:36 AM
You need brackets over:
Vector3 mouseWorldPos3D = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector2 mousePos2D = new Vector2(Input.mouseWorldPos3D.x, Input.mouseWorldPos3D.y);
Like this:
{
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612001551im_/https://answers.unity.com/themes/thub/images/avi.jpg)