I only have one script.
The Error:
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Rendering.Universal.UniversalAdditionalCameraData.get_scriptableRenderer () (at Library/PackageCache/com.unity.render-pipelines.universal@7.3.1/Runtime/UniversalAdditionalCameraData.cs:335)
UnityEditor.Experimental.Rendering.Universal.Light2DEditorUtility.GetRenderer2DData () (at Library/PackageCache/com.unity.render-pipelines.universal@7.3.1/Editor/2D/Light2DEditorUtility.cs:103)
UnityEditor.Experimental.Rendering.Universal.Light2DEditor.OnEnable () (at
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float speed = 5f;
public Animator animator;
public Rigidbody2D rb;
Vector2 move;
SpriteRenderer sr;
// Start is called before the first frame update
void Start()
{
sr = GetComponent<SpriteRenderer>();
}
// Update is called once per frame
void Update()
{
move.x = Input.GetAxisRaw("Horizontal");
animator.SetFloat("Speed", Mathf.Abs(move.x));
if (Input.GetButtonDown("Fire1"))
{
animator.SetTrigger("Attack");
}
}
private void FixedUpdate()
{
rb.MovePosition(rb.position + move * speed * Time.fixedDeltaTime);
if (move.x < 0f)
{
sr.flipX = true;
} else if (move.x > 0f)
{
sr.flipX = false;
}
}
}