title: How to: Get a reference to a UI Image
body: <p>Similar to a previous question I asked, I am now looking to learn how to get a reference for my image <code>TestImage</code> in a script.</p>
  
  <p>So far I've tried this:</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class imageGrab : MonoBehaviour
  {
  
          [Space] public RawImage testImage;
  
           Texture2D profileTexture;
  
  
  
  
      // Start is called before the first frame update
      void Start()
      {
          profileTexture = new Texture2D(2, 2);
      }
  
      void Awake() 
      {
          PlayPortalProfileClient.Instance.GetMyProfilePicture((error, data) =&gt;
              {
                  if (error != null)
                  {
                      ErrorLogging("Error requesting my profile picture.", error);
                  }
                  else
                  {
                      Debug.Log("Got my profile picture successfully.");
  
                      profileTexture.LoadImage(data);
                      testImage.texture = profileTexture;
                  }
              });
      }
  
      // Update is called once per frame
      void Update()
      {
  
      }
  }
  
  </code></pre>
  
  <p>But run into this error, <code>Assets/imageGrab.cs(8,24): error CS0246: The type or namespace name 'RawImage' could not be found (are you missing a using directive or an assembly reference?)</code></p>
  
  <p>What could I do differently to correctly get the reference? Is there something as simple as referencing a text element? Thanks!</p>