A new expression requires (), [], or {} after type?

I’m getting this error that says “A new expression requires (), [ ], or {} after type”. The “)” after “Vector3” is underlined in red. Everything is paired up properly. There aren’t any stray parentheses or brackets anywhere
I can’t figure out what this is referring to.

I’m primarily an artist, so I’m new to scripting. Unfortunately, I haven’t been able to get in touch with my friend who was helping with the code. I would definitely appreciate any ideas on fixing this.

What is it you want to do? the issue is ‘new Vector3’ is trying to create a new instance of a Vector3 so that doesn’t really make sense in the code block you put…

Did you want something like:

if (transform.eulerAngles == Vector3.zero)
{
  animator.SetTrigger("Walking");
  transform.position += Vector3.right * Time.deltaTime;
}

?

What is the if statement supposed to be testing?

Or maybe you just wanted:

transform.eulerAngles = Vector3.zero;
animator.SetTrigger("Walking");
transform.position += Vector3.right * Time.deltaTime;

?

Thank! I think that did it. I’m trying to have the character start walking to the right, once you’re facing right.

1 Like