Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question error 1002

Discussion in 'Scripting' started by damirfajzrahmanoff, Jul 14, 2023.

Thread Status:
Not open for further replies.
  1. damirfajzrahmanoff

    damirfajzrahmanoff

    Joined:
    Jul 13, 2023
    Posts:
    1
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class playerControler : MonoBehaviour
    {
    public float speed;
    public float jumpForce;
    private float moveInput;

    private Rigidbody2D rb;

    private bool facingRight = true;

    private void Start()
    {
    rb = GetComponent<Rigidbody2D>();
    }

    private void FixedUpdate()
    {
    moveInput = Input.GetAxis("Horizontal");
    rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
    if(facingRight == false && moveInput > 0)
    {
    Flip();
    }
    else if(facingRight == true && moveInput < 0)
    {
    Flip();
    }
    }

    void Flip()
    {
    facingRight = !facingRight;
    Vector3 Scaler = transform.lokalScale;
    Scaler.x *= -1;
    transform.lokalScale = Scaler;
    }
    }



    error 37 28
     
    Last edited: Jul 14, 2023
  2. ijmmai

    ijmmai

    Joined:
    Jun 9, 2023
    Posts:
    188
    You should put code-tags around your code to make it easier to read.

    Did you mean
    transform.localScale
    instead of transform lokalScale ?
     
    MelvMay likes this.
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,468
    This isn't valid C# code (see above) and to note that you also missed the period (.)

    Also, please put more effort into posting if you want others to help you. Just stating an error code and dumping some plain text isn't a great way to get help.

    Please see Low Effort posting in the Community Code of Conduct.

    Thanks.
     
Thread Status:
Not open for further replies.