解决了内存泄漏问题(BasicSplineJustFollow.Update中判断材质是否变更的方式有误)
This commit is contained in:
@@ -802,7 +802,7 @@ namespace Demo
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator LoadSubScriptAsync([In] string type, [In] string path, [Opt] Action<ScriptableObject> callback)
|
public IEnumerator DoLoadSubScriptAsync([In] string type, [In] string path, [Opt] Action<ScriptableObject> callback)
|
||||||
{
|
{
|
||||||
// 判断类型是否合法
|
// 判断类型是否合法
|
||||||
if (DefaultInstantiate.GetScriptableObjectInstantiate().TryGetValue(type, out var creater) == false)
|
if (DefaultInstantiate.GetScriptableObjectInstantiate().TryGetValue(type, out var creater) == false)
|
||||||
@@ -858,7 +858,25 @@ namespace Demo
|
|||||||
")]
|
")]
|
||||||
public IEnumerator LoadSubScript([In] string type, [In] string path)
|
public IEnumerator LoadSubScript([In] string type, [In] string path)
|
||||||
{
|
{
|
||||||
yield return LoadSubScriptAsync(type, path, null);
|
return DoLoadSubScriptAsync(type, path, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 异步加载子脚本
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">指定类型</param>
|
||||||
|
/// <param name="path">指定脚本,可用决定路径或与当前脚本目录的相对路径</param>
|
||||||
|
[ScriptableCall(@"
|
||||||
|
<summary>
|
||||||
|
异步加载子脚本
|
||||||
|
</summary>
|
||||||
|
<param name=""type"">指定类型</param>
|
||||||
|
<param name=""path"">指定脚本,可用决定路径或与当前脚本目录的相对路径</param>
|
||||||
|
")]
|
||||||
|
public void LoadSubScriptAsync([In] string type, [In] string path)
|
||||||
|
{
|
||||||
|
StartCoroutine(DoLoadSubScriptAsync(type, path, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum ParseStats
|
private enum ParseStats
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ namespace Demo.Game
|
|||||||
childFileStream.Close();
|
childFileStream.Close();
|
||||||
}
|
}
|
||||||
//不刷新世界,直接加载
|
//不刷新世界,直接加载
|
||||||
so.StartCoroutine(so.LoadSubScriptAsync(type, childFile, targetChildSO =>
|
so.StartCoroutine(so.DoLoadSubScriptAsync(type, childFile, targetChildSO =>
|
||||||
{
|
{
|
||||||
// 打开手动编辑
|
// 打开手动编辑
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -173,14 +173,6 @@ namespace Demo.Game
|
|||||||
if (MyMeshGenerator == null)
|
if (MyMeshGenerator == null)
|
||||||
return;
|
return;
|
||||||
base.UpdateTicks(currentTime, deltaTime, tickType);
|
base.UpdateTicks(currentTime, deltaTime, tickType);
|
||||||
if (currentTime >= Entries[0].TimePoint && (tickType == TickType.Update))
|
|
||||||
{
|
|
||||||
if (MyLineMaterial != MyMeshRenderer.material)
|
|
||||||
{
|
|
||||||
MyMeshRenderer.material = MyLineMaterial;
|
|
||||||
MyMeshGenerator.Rebuild();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Vector3 EvaluateClipFromPosition(float time)
|
public override Vector3 EvaluateClipFromPosition(float time)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Demo.Game
|
|||||||
protected override void UpdateTicks(float currentTime, float deltaTime, TickType tickType)
|
protected override void UpdateTicks(float currentTime, float deltaTime, TickType tickType)
|
||||||
{
|
{
|
||||||
base.UpdateTicks(currentTime, deltaTime, tickType);
|
base.UpdateTicks(currentTime, deltaTime, tickType);
|
||||||
//Updater?.Invoke();
|
Updater?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace Demo.Game
|
|||||||
{
|
{
|
||||||
var spline = self.SharedInterfaceScriptObject.FindWithPath(path, false);
|
var spline = self.SharedInterfaceScriptObject.FindWithPath(path, false);
|
||||||
if (spline == null)
|
if (spline == null)
|
||||||
yield return self.SharedInterfaceScriptObject.LoadSubScriptAsync(nameof(SplineCore), path, x => spline = x);
|
yield return self.SharedInterfaceScriptObject.DoLoadSubScriptAsync(nameof(SplineCore), path, x => spline = x);
|
||||||
if (spline is SplineCore sc)
|
if (spline is SplineCore sc)
|
||||||
{
|
{
|
||||||
self.MySplineCore = sc;
|
self.MySplineCore = sc;
|
||||||
@@ -160,7 +160,7 @@ namespace Demo.Game
|
|||||||
")]
|
")]
|
||||||
public IEnumerator LoadNode(string path)
|
public IEnumerator LoadNode(string path)
|
||||||
{
|
{
|
||||||
yield return LoadSubScriptAsync(nameof(SplineNode), path, node =>
|
yield return DoLoadSubScriptAsync(nameof(SplineNode), path, node =>
|
||||||
{
|
{
|
||||||
if (node is SplineNode _node)
|
if (node is SplineNode _node)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace Demo.Game
|
|||||||
MySplineCore = FindWithPath(path, false) as SplineCore;
|
MySplineCore = FindWithPath(path, false) as SplineCore;
|
||||||
if (MySplineCore == null)
|
if (MySplineCore == null)
|
||||||
{
|
{
|
||||||
yield return LoadSubScriptAsync(nameof(SplineCore), path, x =>
|
yield return DoLoadSubScriptAsync(nameof(SplineCore), path, x =>
|
||||||
{
|
{
|
||||||
MySplineCore = x as SplineCore;
|
MySplineCore = x as SplineCore;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user