Click Effect! How to produce color or sprite on click.

Ok so I have been working on making my own character controller script and slowly adding functionality to it that I want. One thing I have hit a snag on is making a color, or an image or effect appear where the player clicks, which also happens to be the position where the player is headed to.

This is what I have so far.

 using UnityEngine;
using System.Collections;
public class SimpleMove : MonoBehaviour {
     private Transform myTransform;                // this transform
    private Vector3 destinationPosition;        // The destination Point
    private float destinationDistance;            // The distance between myTransform and destinationPosition
    public float moveSpeed;                        // The Speed the character will move
    private Vector3 target;
    private Vector3 lookAtPoint;
    public float rotateSpeed;
    public Texture cColor;
    private SpriteRenderer spriteRenderer;
     void Start () {
         target = transform.position;
         myTransform = transform;                            // sets myTransform to this GameObject.transform
        destinationPosition = myTransform.position;            // prevents myTransform reset
        spriteRenderer = GetComponent<SpriteRenderer>();
        if (!spriteRenderer){
            Debug.Log("need a spriteRenderer");
        } else {
            spriteRenderer.transform = myTransform;
        }
     }
    
     void Update () {
         destinationDistance = Vector3.Distance(destinationPosition, myTransform.position);
         if (Input.GetMouseButtonDown(0)) {
             target = Camera.main.ScreenToWorldPoint(Input.mousePosition);
             Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
             Plane groundPlane = new Plane(Vector3.up, transform.position);
              float rayDistance;
                if (groundPlane.Raycast(ray, out rayDistance))
                {
                    lookAtPoint = ray.GetPoint(rayDistance);
                    destinationPosition =ray.GetPoint(rayDistance);
                }

                Quaternion targetRotation = Quaternion.LookRotation(lookAtPoint - transform.position, Vector3.up);
                transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2.0f * rotateSpeed);
             target.z = transform.position.z;
         }
         myTransform.position = Vector3.MoveTowards(myTransform.position, destinationPosition, moveSpeed * Time.deltaTime);
     }   
}

My problem ofcouse is I have no idea how to be using the spriterender correctly. I am getting an error telling me that [quote]
Property or indexer `UnityEngine.Component.transform’ cannot be assigned to (it is read only)
[/quote]
and all I was trying to do to start was make the sprite appear in the same spot as the player (the gameobject it is attatched to), this isn’t really important, my main priority or focus or desire really is to not have it appear but for just a split second where the player clicked and dissappear as well. Also I have looked into many other options such as OnGuiDraw, and many more but any help in getting this basics to work and explaining to me the code used would be much appreciated.

It’s says exactly what the error is, you can’t simply assign a transform to an another transform. Just think about how many things it could break. If you want to keep the position, use Vector3 position = transform.position;
you want the rotation? Quaternion rot = transform.rotation;

EDIT:
by the way, your title is a tad bit unrelated to the problem

Thanks for the reply but I hate to point out that you didn’t help at all. There must be a miscommunication, but I specifically said what I was trying to do (The name of the thread, doesn’t matter which one), and what my problem was, and you didn’t really tell me how to fix it.

Vector3 position = transform.position

take a look at line 26, did you even look at the code? I am obviously a very new person who barely knows the syntax of C# and not much more, let alone the api for unity yet. I am learning, very much learning. And what you told me was nothing, it was less than nothing, you gave me some little bits of code that are already used in my script as it is. How about breaking down what it is you told me because if thats the code I need to make it work and I’m already doing that then obviously i am not completely understanding what it is I am doing. I come here for help, pls don’t mistreat me and boost your post count and try to make it all look as if you were being helpful.

My title will stay as it is because I am still hoping someone can show me such as simpler way to make a small effect appear where I just click without me having to have it overcomplicated by using a spriterenderer.

Your error states, that youre trying to assign a transform to an another transform, on line 15, I tried to help yoi fix your code
The rest of the script I actually read surprise surprise, but I didnt had the time to help you. If you want to get the point a player is looking at, you neee to raycast. You have the ray, the only thing left to do is to sikply cast it, using:

HitInfo hit;
If (Physics.Raycast(ray, out hit)) {
  And the point is hit.point
}

But theres a useful webpage out there for starters, and for those who seek answee for their quiestion, and yes, Im talking about google, because if you type in "get point player is looking at unity) then you get plenty of material to work with. And then you can use a sprite renderer, an object, a particle effect, whatever comes in your mind

Next time Ill give you a lmgtfy link with how to not be assholes to the guy who tries to help