mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
Keep the loading ring sprite alive across scene loads
This commit is contained in:
1 parent
a88f9b6611
commit
9cefeebe2b
1 file changed
+9
-2
@@ -26,7 +26,11 @@ public class LoadingRing(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// <returns>The created <see cref="LoadingRing"/>.</returns>
|
||||
public static LoadingRing Create(Transform parent, Vector3 localPosition, float scale)
|
||||
{
|
||||
_ringSprite ??= CreateRingSprite();
|
||||
if (!_ringSprite)
|
||||
{
|
||||
_ringSprite = CreateRingSprite();
|
||||
}
|
||||
|
||||
var obj = new GameObject("LoadingRing")
|
||||
{
|
||||
transform =
|
||||
@@ -76,6 +80,9 @@ public class LoadingRing(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
|
||||
texture.SetPixels(pixels);
|
||||
texture.Apply();
|
||||
return Sprite.Create(texture, new Rect(0, 0, size, size), new Vector2(0.5f, 0.5f), 100f);
|
||||
texture.hideFlags = HideFlags.HideAndDontSave;
|
||||
var sprite = Sprite.Create(texture, new Rect(0, 0, size, size), new Vector2(0.5f, 0.5f), 100f);
|
||||
sprite.hideFlags = HideFlags.HideAndDontSave;
|
||||
return sprite;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user