![Schaken-Mods](/assets/img/avatar_default.png)
There is an asset in the store I grabbed. the coding is WAY above my head, I got about half of it and integrated and adapted what I can to it. im going as far as I can with it and ill come back in a few month when I understand t better.
32 lines
963 B
C#
32 lines
963 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.Networking;
|
|
|
|
public class ModPrefab : MonoBehaviour
|
|
{
|
|
[SerializeField] public RawImage Screenshot;
|
|
[SerializeField] public TextMeshProUGUI Title;
|
|
[SerializeField] public TextMeshProUGUI Date;
|
|
[SerializeField] public TextMeshProUGUI Author;
|
|
[SerializeField] public TextMeshProUGUI Description;
|
|
[SerializeField] public string ModID;
|
|
|
|
public void LoadSS(string imagePath) {
|
|
StartCoroutine(LoadCurrentImageX(imagePath));
|
|
}
|
|
|
|
IEnumerator LoadCurrentImageX(string imagePath) {
|
|
UnityWebRequest WWW = UnityWebRequestTexture.GetTexture(imagePath);
|
|
yield return WWW.SendWebRequest();
|
|
if (WWW.result != UnityWebRequest.Result.ConnectionError) {
|
|
Screenshot.texture = DownloadHandlerTexture.GetContent(WWW);
|
|
Screenshot.SetNativeSize();
|
|
Screenshot.SizeToParent();
|
|
}
|
|
WWW.Dispose();
|
|
}
|
|
}
|