title: Why is the object's color not being loaded?
body: <p>I've managed to save a 3D object's position, rotation, scale, color, and shape. However, when I try to load the object, the color doesn't display; but everything else is working fine. I tried using "newObject.GetComponent().material.color = colorOfObject" via a peer's suggestion, but the compiler doesn't like the syntax. Am I on the right track?</p>
  
  <p>Note: I just included my code for the cube option to provide a shorter block of code, but I do have other shape options that the user can choose.</p>
  
  <pre><code>        // Saving
          if (GUI.Button(new Rect(700, 330, 50, 30), "Save"))
          {
              // Saving the object's color and resetting it to white
              Color colorOfObject = rend.material.GetColor("_Color");
              PlayerPrefs.SetFloat("rValue", colorOfObject.r);
              PlayerPrefs.SetFloat("gValue", colorOfObject.g);
              PlayerPrefs.SetFloat("bValue", colorOfObject.b);
              rend.material.SetColor("_Color", Color.white);
          }
  
          // Loading
          if (GUI.Button(new Rect(770, 330, 50, 30), "Load"))
          {
              GameObject newObject;
  
              if (PlayerPrefs.GetString("Shape") == "cube")
          {
              newObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
              newObject.AddComponent&lt;cubeControls&gt;();
  
              newObject.transform.position = new Vector3(PlayerPrefs.GetFloat("xCoord"), PlayerPrefs.GetFloat("yCoord"), PlayerPrefs.GetFloat("zCoord"));
              newObject.transform.rotation = Quaternion.Euler(PlayerPrefs.GetFloat("xRot"), PlayerPrefs.GetFloat("yRot"), PlayerPrefs.GetFloat("zRot"));
              newObject.transform.localScale = new Vector3(PlayerPrefs.GetFloat("xScale"), PlayerPrefs.GetFloat("yScale"), PlayerPrefs.GetFloat("zScale"));
  
              Color defaultColor = Color.white;
              Color colorOfObject = new Color(PlayerPrefs.GetFloat("rValue", defaultColor.r), PlayerPrefs.GetFloat("gValue", defaultColor.g), PlayerPrefs.GetFloat("bValue", defaultColor.b));
              //rend.material.SetColor("_Color", colorOfObject);
              newObject.GetComponent().material.color = colorOfObject;
              Destroy(gameObject);
          }
  </code></pre>