Как и в предыдущем вопросе, который я задал, я сейчас пытаюсь узнать, как получить ссылку на мое изображение TestImage
в сценарии.
Пока я пробовал это:
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) =>
{
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()
{
}
}
Но столкнуться с этой ошибкой, 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?)
Что я мог бы сделать по-другому, чтобы правильно получить ссылку? Есть ли что-то столь же простое, как ссылка на текстовый элемент? Спасибо!