So I was just minding my own business making a quick little game in Unity2D and then I got these error that I am unsure of how to fix or what they mean:
`TLS Allocator ALLOC_TEMP_THREAD, underlying allocator ALLOC_TEMP_THREAD has unfreed allocations, size 28`
and
`Allocation of 28 bytes at 0000022F800000B0`
I am assuming these are being caused by a memory leak but I am not sure and nothing in my code looks like it would cause a memory leak.
Here is the only script I have in my game right now:
`
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
protected float speed = 10.0f;
protected float jumpSpeed = 15.0f;
protected bool isGrounded = false;
public Rigidbody2D rb2;
void Update()
{
if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
{
rb2.AddForce(transform.right * -speed);
} else if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
{
rb2.AddForce(transform.right * speed);
} else if (Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.UpArrow))
{
if (isGrounded)
{
rb2.AddForce(transform.up * jumpSpeed);
}
}
}
void OnCollisionEnter2D(Collision2D col)
{
if (col.gameObject.tag == "Ground")
{
isGrounded = true;
}
}
void OnCollisionExit2D(Collision2D col)
{
isGrounded = false;
}
}
`
(^ yeah i know it's really messy don't judge me)
So what in this script is causing this error
↧