The left-hand side of an assignment must be a variable, a property or an indexer

Discussion in 'Scripting' started by AArgueta, Jan 4, 2013.

  1. AArgueta

    AArgueta

    New Member

    Joined:
    Dec 29, 2012
    Messages:
    8
    Hello there!

    Please I need some help, I'm just using the ActivateTrigger.cs and Im crashing with this errors:

    Assets/Standard Assets/Scripts/General Scripts/ActivateTrigger.cs(53,58): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer

    And it points to the lines marked in red down here:


    switch (action) {
    case Mode.Trigger:
    targetGameObject.BroadcastMessage ("DoActivateTrigger");
    break;
    case Mode.Replace:
    if (source != null) {
    Object.Instantiate (source, targetGameObject.transform.position, targetGameObject.transform.rotation);
    DestroyObject (targetGameObject);
    }
    break;
    case Mode.Activate:
    targetGameObject.SetActive () = true;
    break;
    case Mode.Enable:
    if (targetBehaviour != null)
    targetBehaviour.enabled = true;
    break;
    case Mode.Animate:
    targetGameObject.animation.Play ();
    break;
    case Mode.Deactivate:
    targetGameObject.SetActive () = false;
    break;
    }
    }
    }

    I will thanks a lot any help you can give me,

    All the best and happy new year 2013!
    Thanks!
    :)
  2. Landern

    Landern

    Member

    Joined:
    Dec 21, 2008
    Messages:
    346
    first, you really need to format your code using the code tags.

    You are trying to pass bool on the right hand side of equal sign... to a function, functions take parameters within the parentheses.. in this case.. it's a function.

    Code (csharp):
    1.  
    2. switch (action) {
    3.     case Mode.Trigger:
    4.         targetGameObject.BroadcastMessage ("DoActivateTrigger");
    5.         break;
    6.     case Mode.Replace:
    7.         if (source != null) {
    8.             Object.Instantiate (source, targetGameObject.transform.position, targetGameObject.transform.rotation);
    9.             DestroyObject (targetGameObject);
    10.         }
    11.         break;
    12.     case Mode.Activate:
    13.         targetGameObject.SetActive (true);
    14.         break;
    15.     case Mode.Enable:
    16.         if (targetBehaviour != null)
    17.             targetBehaviour.enabled = true;
    18.         break
    19.     case Mode.Animate:
    20.         targetGameObject.animation.Play ();
    21.         break
    22.     case Mode.Deactivate:
    23.         targetGameObject.SetActive (false);
    24.         break;
    25.     }
    26.  
  3. AArgueta

    AArgueta

    New Member

    Joined:
    Dec 29, 2012
    Messages:
    8
    Hi Landern!
    Thanks a lot for your answer! it was fixed.
    But I'm still having another error like this one:

    error CS1061: Type `UnityEngine.Mesh' does not contain a definition for `Triangle' and no extension method `Triangle' of type `UnityEngine.Mesh' could be found (are you missing a using directive or an assembly reference?)

    pointing here in red too:

    }

    Mesh mesh = new Mesh();
    mesh.name = "Combined Mesh";
    mesh.vertices = vertices;
    mesh.normals = normals;
    mesh.colors = colors;
    mesh.uv = uv;
    mesh.uv1 = uv1;
    mesh.tangents = tangents;
    if (generateStrips)
    mesh.SetTriangle (strip, 0);
    else
    mesh.triangles = triangles;

    return mesh;
    }

    Any idea of what could be?
    Thanks for your support!

    Cheers!
  4. RazorCut

    RazorCut

    Member

    Joined:
    May 7, 2009
    Messages:
    386
  5. AArgueta

    AArgueta

    New Member

    Joined:
    Dec 29, 2012
    Messages:
    8
    Thanks a lot RazorCut!

    It was more clear after read the documents.
    Thanks for share!

    Cheers!
    :)