Skip to content

Commit 7b101c8

Browse files
committed
Merge branch 'main' into feature/mem-cat
2 parents 282cb6a + 30f8f77 commit 7b101c8

File tree

5 files changed

+33
-7
lines changed

5 files changed

+33
-7
lines changed

Runtime/Code/Luau/LuauCoreCallbacks.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,9 @@ private static Delegate CreateSetter<T>(PropertyInfo propertyInfo, bool isStatic
659659
}
660660

661661
private static T GetValue<T>(object instance, PropertyGetReflectionCache cacheData) {
662-
if (typeof(T) == typeof(object)) {
662+
// if (typeof(T) == typeof(object)) {
663663
return (T) cacheData.propertyInfo.GetMethod.Invoke(instance, null);
664-
}
664+
// }
665665

666666
if (!cacheData.HasGetPropertyFunc) {
667667
var getMethod = cacheData.propertyInfo.GetGetMethod();
@@ -689,6 +689,9 @@ private static T GetValue<T>(object instance, PropertyGetReflectionCache cacheDa
689689
}
690690

691691
private static void SetValue<T>(object instance, T value, PropertyInfo pi) {
692+
pi.SetValue(instance, value);
693+
return;
694+
692695
var staticSet = instance == null;
693696
if (!_propertySetterCache.TryGetValue((staticSet, pi.DeclaringType, pi.Name), out var setter)) {
694697
setter = CreateSetter<T>(pi, staticSet);

Runtime/Code/Misc/TubeRendererCS.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ void Awake() {
3434
}
3535

3636
_mesh = new Mesh();
37+
_mesh.name = "Tube Mesh";
3738
_meshFilter.mesh = _mesh;
3839
}
3940

@@ -78,7 +79,6 @@ public void SetPositions(Vector3[] positions) {
7879

7980
private void GenerateMesh() {
8081
if (_mesh == null || _positions == null || _positions.Length <= 1) {
81-
_mesh = new Mesh();
8282
return;
8383
}
8484

@@ -117,6 +117,10 @@ private void GenerateMesh() {
117117
_meshFilter.mesh = _mesh;
118118
}
119119

120+
private void OnDestroy() {
121+
Destroy(_mesh);
122+
}
123+
120124
private Vector2[] GenerateUVs() {
121125
var uvs = new Vector2[_positions.Length * _sides];
122126

Runtime/Code/VoxelWorld/Editor/VoxelWorldEditor.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,14 @@ public override void OnInspectorGUI() {
332332

333333
if (world.voxelWorldFile != null) {
334334
if (GUILayout.Button("Load")) {
335-
Load(world);
335+
if (world.hasUnsavedChanges) {
336+
if (EditorUtility.DisplayDialog("Discarding Changes",
337+
"Are you sure you want to discard unsaved changes to the Voxel World?", "Discard", "Cancel")) {
338+
Load(world);
339+
}
340+
} else {
341+
Load(world);
342+
}
336343
}
337344

338345
if (world.chunks.Count > 0) {

Runtime/Code/VoxelWorld/VoxelMeshProcessor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1544,7 +1544,8 @@ public static GameObject ProduceSingleBlock(int blockIndex, VoxelWorld world, fl
15441544
meshRenderer.sharedMaterial = world.voxelBlocks.atlasMaterial;
15451545

15461546
Mesh theMesh = new Mesh();
1547-
1547+
theMesh.name = "SingleBlock";
1548+
15481549
//Center around 0,0,0
15491550
Vector3 origin = new Vector3(-0.5f, -0.5f, -0.5f);
15501551
int flip = 0;

Runtime/Code/VoxelWorld/VoxelWorldChunk.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,13 @@ public void Clear() {
438438
detailGameObjects[i] = null;
439439
}
440440
}
441+
442+
if (detailMeshes != null) {
443+
foreach (var detailMesh in detailMeshes) {
444+
Object.Destroy(detailMesh);
445+
}
446+
}
447+
441448
obj = null;
442449
}
443450
}
@@ -550,8 +557,11 @@ private bool DoVisualUpdate(VoxelWorld world) {
550557
obj.transform.localPosition = Vector3.zero;
551558
obj.hideFlags = HideFlags.DontSaveInEditor | HideFlags.DontSaveInBuild;
552559
obj.name = "Chunk";
553-
554-
if (mesh == null) mesh = new Mesh();
560+
561+
if (mesh == null) {
562+
mesh = new Mesh();
563+
mesh.name = "VoxelWorldChunk";
564+
}
555565
// mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32; //Big boys
556566

557567
filter = obj.AddComponent<MeshFilter>();
@@ -597,6 +607,7 @@ private bool DoVisualUpdate(VoxelWorld world) {
597607
detailRenderers[i].shadowCastingMode = ShadowCastingMode.Off;
598608

599609
detailMeshes[i] = new Mesh();
610+
detailMeshes[i].name = detailGameObjects[i].name;
600611
// detailMeshes[i].indexFormat = UnityEngine.Rendering.IndexFormat.UInt32; //Big boys
601612

602613
detailFilters[i].mesh = detailMeshes[i];

0 commit comments

Comments
 (0)