Skip to content

Commit

Permalink
Rearrange and update
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaPiggy committed Jul 23, 2024
1 parent 9f865ff commit 856d423
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEngine;
using UnityEngine.UI;

namespace Winch.Serialization.Character
namespace Winch.Components
{
public class SpeakerPortraitAnimator : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System;
using UnityEngine;
using UnityEngine.UI;
using Winch.Components;
using Winch.Util;

namespace Winch.Serialization.Character
namespace Winch.Data.Character
{
public class AdvancedSpeakerData : SpeakerData
{
Expand All @@ -15,7 +16,7 @@ public class AdvancedSpeakerData : SpeakerData

public void AddPortraitPrefab()
{
portraitPrefab = new GameObject($"{id} PortraitPrefab", typeof(RectTransform), typeof(Canvas), typeof(GraphicRaycaster), typeof(SpeakerPortraitAnimator));
portraitPrefab = new GameObject($"{id} PortraitPrefab", typeof(RectTransform), typeof(Canvas), typeof(GraphicRaycaster), typeof(SpeakerPortraitAnimator)).Prefabitize();
portraitPrefab.layer = Layer.UI;
var imageObj = new GameObject(id, typeof(RectTransform), typeof(CanvasRenderer), typeof(Image));
imageObj.transform.SetParent(portraitPrefab.transform, false);
Expand All @@ -25,7 +26,6 @@ public void AddPortraitPrefab()
image.sprite = portraitSprite;
image.preserveAspect = true;
image.raycastTarget = false;
portraitPrefab.DontDestroyOnLoad();
}
}
}
1 change: 1 addition & 0 deletions Winch/Serialization/Character/SpeakerDataConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using UnityEngine.Localization;
using UnityEngine.UI;
using Winch.Core;
using Winch.Data.Character;
using Winch.Util;

namespace Winch.Serialization.Character;
Expand Down
1 change: 1 addition & 0 deletions Winch/Util/CharacterUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using UnityEngine.Analytics;
using UnityEngine.Localization;
using Winch.Core;
using Winch.Data.Character;
using Winch.Serialization;
using Winch.Serialization.Character;

Expand Down
2 changes: 1 addition & 1 deletion Winch/Util/WinchExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ internal static Transform PrefabParent
/// </summary>
public static GameObject Prefabitize(this GameObject obj)
{
obj.transform.SetParent(PrefabParent, false);
obj.DontDestroyOnLoad().transform.SetParent(PrefabParent, false);
return obj;
}

Expand Down

0 comments on commit 856d423

Please sign in to comment.