new unity and C# user. i appear to be confuddled into a quandary, im using getcomponent() to call on variables from different scripts and im getting the Operator ‘!=’ cannot be applied to operands of type ‘float’ and ‘levelmanager’ wherever applicable in my script here:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class badworks : MonoBehaviour {
private GameObject theTarget;
public GameObject badGameObject;
private levelmanager Levelmanager;
void Awake(){
Levelmanager = badGameObject.GetComponent<levelmanager> ();
}
void Start () {
float i = 0;
while (i != Levelmanager.EnemyPerLevel){ // error: Operator '!=' cannot be applied to operands of type 'float' and 'levelmanager'
Instantiate(badGameObject, new Vector3(6.2f,0.6f,4.3f),Quaternion.identity);
}
theTarget = GameObject.FindGameObjectWithTag ("Player");
if (theTarget == null){
Debug.Log("WARNING: The Player tag could not be found");
}
}
void oppCollision (Collision c){
if (c.gameObject.tag == "Bullet") {
Levelmanager.BadHealth = Levelmanager.BadHealth - Levelmanager.BulletDamage; //error: Operator '-' cannot be applied to operands of type 'levelmanager' and 'levelmanager'
}
}
void Update () {
if (Levelmanager.BadHealth == 0) { //error: operator '==' cannot be applied to operands of type 'levelmanager' and 'int'
Destroy (this.gameObject);
}
if (theTarget != null){
transform.LookAt(theTarget.transform.position);
transform.position += (transform.forward * Levelmanager.BadMoveRate); //error: operator '*' cannot be applied to operands of type 'UnityEngine.Vector3' and 'levelmanager'
}
}
}
seems like an ez fix yet i’m currently not sure what’s stirring my sprinkles