Skip to content

Commit

Permalink
fix(click-listener): update collision mesh when mesh changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mwfarb committed Mar 1, 2023
1 parent bbf31a6 commit a2da15a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Runtime/ArenaMesh/ArenaMesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ namespace ArenaUnity
public abstract class ArenaMesh : MonoBehaviour
{
protected MeshFilter filter;
protected MeshCollider mc;
internal bool build = false;
internal bool scriptLoaded = false;

protected virtual void Start()
{
filter = GetComponent<MeshFilter>();
Build(filter);
mc = GetComponent<MeshCollider>();
if (mc != null) mc.sharedMesh = filter.mesh;
}
protected abstract void Build(MeshFilter filter);

Expand All @@ -40,6 +43,8 @@ protected void Update()
if (build)
{
Build(filter);
mc = GetComponent<MeshCollider>();
if (mc != null) mc.sharedMesh = filter.mesh;
build = false;
}
}
Expand Down

0 comments on commit a2da15a

Please sign in to comment.