This question didn’t make much sense to me and I had trouble parsing it, but I think I realized that the confusion is coming from a misconception: Are you applying struct-based logic to classes? Or, to elaborate:
To change the X value of transform.position you have to do this familiar dance:
Vector3 pos = transform.localPosition;
pos.x = 5f;
transform.localPosition = pos;
The third line there is important because, when you get the position, it returns a copy of the position (because Vector3 is a struct, which are always passed by value), so pos.x only changes the copy, and you have to reassign it. We’re on the same page right now, right?
OK, now you move over to components. So let’s use this code:
spawnedCar.GetComponent<CopController>().someStringProperty = "old";
CopController CC = spawnedCar.GetComponent<CopController>();
CC.someStringProperty = "new";
Debug.Log(spawnedCar.GetComponent<CopController>().someStringProperty);
Now if I understand your mindset correctly, you’re probably thinking that that debug.Log would print out “old”. Is that right?
If so, then there’s the source of your confusion, because that’s wrong - it will print out “new”. Go ahead, add a string variable to your class and try it out.
The reason is that components are a class, not a struct. Because they’re a class, your variable CC doesn’t contain a CopController object per se, but rather points to the same CopController object that is held by the GameObject.
So the answer to your question is, just store “CC” and use that to change values - no need to ever reassign it to apply the changes back to your component, it’ll always be pointing to your component, live on the GameObject, and changes you make to it will work.