[Solved] Expected } in physics script


#1

Hello; I’m trying to do this tutorial but there’s an error. I seem to have misplaced a curly brace.

    {
    public class Trigger : AsyncScript
    {
        // Declared public member fields and properties will show in the game studio

        public override async Task Execute()
        {   
        var trigger = Entity.Get<PhysicsComponent>();
            trigger.ProcessCollisions = true;
        {
            while(Game.IsRunning)
            {
                    // Wait for an entity to collide with the trigger
                    var firstCollision = await trigger.NewCollision();

                    var otherCollider = trigger == firstCollision.ColliderA
                        ? firstCollision.ColliderB
                        : firstCollision.ColliderA;
                    otherCollider.Entity.Transform.Scale = new Vector3(2.0f, 2.0f, 2.0f);

                    // Wait for the entity to exit the trigger
                    Collision collision;

                    do
                    {
                        collision = await trigger.CollisionEnded();
                    }
                    while (collision != firstCollision);

                    otherCollider.Entity.Transform.Scale = new Vector3(1.0f, 1.0f, 1.0f);
            }
        }
    }
}

#2

Hy, so I think your wrong { curly bracket is after the line (trigger.ProcessCollisions = true;):

A good trick is to travel the lines vertically and look for bracket open/closed pattern.

Best regards =)


#3

Thanks- getting rid of that bracket did the trick. Now to run it…!