How to fix error CS0029: Cannot implicitly convert type `string' to `bool'

HI All guy, I have a question about Unity.
I have written a script bit it doesn’t work

Assets/Menu.cs(7,17): error CS0029: Cannot implicitly convert type string' to bool’

using UnityEngine;

using System.Collections;

public class Menu : MonoBehaviour {

void OnCollisionEnter(Collision collision){


This line here:


Does nothing. You have two important syntax errors- first, you are putting a semicolon at the end of an if-statement (which will stop it from functioning properly) and second you are using the assignment operator, rather than the evaluation operator (= instead of ==). Try this instead:

if(gameObject.tag == "Player")
    // stuff

if(gameObject.tag == “Player”) or if(gameObject.CompareTag(“Player”))

hey guys I have a problem as well that u might help with:
this is the code:
Debug.Log(“Starting animation split process…”);
string assetPath = AssetDatabase.GetAssetPath(DestinationAsset);

    if (assetPath.Contains(objectName))
        ModelImporter modelImporter = ModelImporter.GetAtPath(assetPath) as ModelImporter;
        modelImporter.clipAnimations = true;
        modelImporter.generateAnimations = ModelImporterGenerateAnimations.InRoot;

        // Set the number of animations here
        int numAnimations = total;
        ModelImporterClipAnimation[] animations = new ModelImporterClipAnimation[numAnimations];

        XmlNodeList list = doc.GetElementsByTagName("Data");
        int i = 0;
        foreach (XmlNode node in list)
            XmlAttributeCollection child = node.Attributes;
            string name = "";
            int sf = 0;
            int ef = 0;

            foreach (XmlNode nd in child)
                if (nd.Name == "name")
                    name = nd.Value;
                if (nd.Name == "startFrame")
                    sf = int.Parse(nd.Value.Replace("f", ""));
                if (nd.Name == "endFrame")
                    ef = int.Parse(nd.Value.Replace("f", ""));

            bool loop = false;
            string nm = name.ToLower();

            if (nm.Contains("idle") || nm.Contains("walk") || nm.Contains("sprint") || nm.Contains("run") || nm.Contains("strafe"))
                loop = true;

            animations *= SetClipAnimationNew(nm, sf, ef, loop);*

modelImporter.clipAnimations = animations;
Object asset = AssetDatabase.LoadAssetAtPath(assetPath, typeof(GameObject));
AssetDatabase.ImportAsset(assetPath, ImportAssetOptions.ForceUpdate);
this what is says in unity :
Assets/GameContent/Motiontracks/Editor/AnimationImporter.cs(26,27): error CS0029: Cannot implicitly convert type bool' to UnityEditor.ModelImporterClipAnimation[]’
if anyone could help :slight_smile:

i need help with the same problem and i have no syntax errors heres my code plz help

enter code hereusing UnityEngine;
using System.Collections;

public class Goal1 : MonoBehaviour {
	public string text;
	public bool display = false;

	// Use this for initialization
	void Start () {
	// Update is called once per frame
	void Update () {
	void OnTriggerEnter(Collider iCollide){
		if( == "Player") {
		display = true;

	void OnGUI() {
			if(display == true) {
			GUI.Box (new Rect(0,50,Screen.width,Screen.height-50), text);