So I made this playerMovement script, where I am working on getting the player to be able to jump. I am having a problem concerning conversion of variables, in my case:
AssetsScriptsPlayerMovement.cs(32,12): error CS0029: Cannot implicitly convert type ‘string’ to ‘bool’
Here’s my script (all the playerJump properties are italic):using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float speed = 5f;
Rigidbody rb;
bool canJump = false;private void Start() {
rb = GetComponent<Rigidbody>();
}
void Update()
{
canJump = false;float xMov = Input.GetAxisRaw("Horizontal");
float zMov = Input.GetAxisRaw("Vertical");
if(Input.GetKeyDown("space")) {
rb.AddForce(0, 800, 0 * Time.deltaTime);
}
rb.velocity = new Vector3 (xMov*speed, rb.velocity.y, zMov*speed)*Time.deltaTime;
}
void OnCollisionEnter(Collision collision) {
if(collision.gameObject.tag = “Ground”) {
canJump == bool.Parse(true);
}
}
void OnCollisionExit(Collision collision) {
if(collision.gameObject.tag = “Ground”) {
canJump == bool.Parse(false);
}
}
}
not sure if this is your problem but one issue is
if(collision.gameObject.tag = “Ground”) {
you need the == operator for comparisons
edit
You also are using == to assign canJump. That needs to be a single =
Yes, those were two problems on their own it appears. I still get the same error message obviously as I haven’t done anything with the variables.