1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. Unity 5.6 is now released.
    Dismiss Notice
  3. Check out all the fixes for 5.5 in patch releases 1 & 2.
    Dismiss Notice
  4. Get further faster with the Unity Plus Accelerator Pack, free for new Unity Plus subscribers for a limited time. Click here for more details.
    Dismiss Notice
  5. Learn how you'll soon be able to publish your games to China in four simple steps with Xiaomi. Sign up now for early access.
    Dismiss Notice

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

    Joined:
    Dec 29, 2012
    Posts:
    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

    Joined:
    Dec 21, 2008
    Posts:
    354
    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

    Joined:
    Dec 29, 2012
    Posts:
    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

    Joined:
    May 7, 2009
    Posts:
    394
  5. AArgueta

    AArgueta

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

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

    Cheers!
    :)