Hello Unity & Devs,
I’ve found an issue while using Muse Chat.
for example. If I say “how do I make 2d character controller” to Unity Muse. it will generate a C# script for me of course which is very good but there is an issue in the code.
using UnityEngine;
public class CharacterController2D : MonoBehaviour
{
public float speed = 5f;
public float jumpForce = 10f;
public LayerMask groundLayer;
private Rigidbody2D rb;
private Collider2D col;
private bool isGrounded;
void Start()
{
rb = GetComponent();
col = GetComponent();
}
void Update()
{
float horizontal = Input.GetAxis("Horizontal");
rb.velocity = new Vector2(horizontal * speed, rb.velocity.y);
isGrounded = Physics2D.IsTouchingLayers(col, groundLayer);
if (Input.GetButtonDown("Jump") && isGrounded)
{
rb.AddForce(Vector2.up * jumpForce, ForceMode2D.Impulse);
}
}
}
The && operator is showing as & amp ;& amp ; which of course gives the syntax error in Unity3D. please check this issue. I hope it can be solved as soon as possible.
