-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModelLoader.cs
647 lines (522 loc) · 26.6 KB
/
ModelLoader.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
using UnityEngine;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using UnityEngine.UI;
using UnityEngine.Video;
using UnityEngine.EventSystems;
public class ModelLoader : MonoBehaviour
{
public string modelsFolderPath; // The path to the models folder inside Resources folder
public string SagittalModelsFolderPath; // The alternative path to the models folder
public string CoronalModelsFolderPath;
private bool isAlternativePath = false; // Flag to track the current path state
public GameObject sagittalGameObject; //For HalfDesing with both supports.
public GameObject coronalGameObject;
private string[] desiredNames = {
"left iliac vein", "left iliac vein", "cava and right iliac vein", "cava and renal vein", "right gonadal vein",
"left gonadal vein", "cava and right iliac vein", "portal venous system", "right gonadal artery", "right iliac artery",
"aorta and left iliac artery", "celiac arterial trunk", "bladder", "right kidney", "left kidney",
"left ureter", "right ureter", "posterior back", "left iliac bone", "spinal cord and ribs",
"sacrum", "right femur", "left femur", "right iliac bone", "uterus and vagina",
"heart", "spleen", "liver", "urachus", "left umbilical ligament",
"right umbilical ligament"
}; // Example array of desired names: REMOVE ANTERIOR WALL FROM MODELS FOLDER
public GameObject modelsParent; // Parent GameObject to hold the instantiated models
public string cameraName;
//public GameObject tipParent; // Parent GameObject to hold the instantiated tool tip
// New variables for the button and its states
private GameObject mainButton;
private GameObject changeViewButton;
private bool areModelsShown = true;
private void Start()
{ // Call the method to load the models by ascending order number
LoadModels();
// Call the method to add the specific material for each model
AddMaterial();
// Call the method to display Unity screen in two halves
DisplayScreenInTwoHalves();
//Call the method to create main button for show or hide all organs
MainButton();
// Create and configure the button
CreateChangeViewButton();
// Deactivate the sagittal game object and its children by default
sagittalGameObject.SetActive(false);
}
private void Update()
{
}
// Function for loading all the models and the components and scripts attached to them.
private void LoadModels()
{
// Load all models from the specified folder
GameObject[] models = Resources.LoadAll<GameObject>(modelsFolderPath);
// Sort the models based on the number in their name in ascending order
List<GameObject> sortedModels = models.OrderBy(model =>
{
int number = ExtractNumber(model.name);
return number;
}).ToList();
// Create a parent GameObject if it doesn't exist
if (modelsParent == null)
{
modelsParent = new GameObject("ModelsParent");
}
// Instantiate the models as child objects under the parent GameObject
for (int i = 0; i < sortedModels.Count; i++)
{
GameObject instantiatedModel = Instantiate(sortedModels[i], modelsParent.transform);
// Add MeshFilter component
MeshFilter meshFilter = instantiatedModel.GetComponent<MeshFilter>();
if (meshFilter == null)
{
meshFilter = instantiatedModel.AddComponent<MeshFilter>();
}
// Add MeshCollider component
MeshCollider meshCollider = instantiatedModel.GetComponent<MeshCollider>();
if (meshCollider == null)
{
meshCollider = instantiatedModel.AddComponent<MeshCollider>();
}
// Add MeshRenderer component
MeshRenderer meshRenderer = instantiatedModel.AddComponent<MeshRenderer>();
// Find and assign the mesh to the MeshFilter based on the original model's name
string originalName = sortedModels[i].name;
string prefabPath = Path.Combine(modelsFolderPath, originalName);
GameObject prefab = Resources.Load<GameObject>(prefabPath);
if (prefab != null)
{
// Instantiate the prefab to get access to its mesh
GameObject prefabInstance = Instantiate(prefab);
Mesh prefabMesh = prefabInstance.GetComponentInChildren<MeshFilter>().sharedMesh;
if (prefabMesh != null)
{
// Assign the prefab's mesh to the instantiated model's MeshFilter and MeshCollider
meshFilter.sharedMesh = prefabMesh;
meshCollider.sharedMesh = prefabMesh;
}
// Destroy the instantiated prefab
Destroy(prefabInstance);
}
// Change the game object name to the desired name from the array
if (i < desiredNames.Length)
{
instantiatedModel.name = desiredNames[i];
}
else
{
// Handle the case where there are more models than names in the array
instantiatedModel.name = "ARSupportPiece" + i.ToString();
}
}
}
// Function to add the material to each model taking into account the name.
private void AddMaterial()
{
// Load the materials from the Resources folder
Material veinMaterial = Resources.Load<Material>("Materials/vein");
Material arteryMaterial = Resources.Load<Material>("Materials/artery");
Material kidneyMaterial = Resources.Load<Material>("Materials/kidney");
Material liverMaterial = Resources.Load<Material>("Materials/liver");
Material skinMaterial = Resources.Load<Material>("Materials/skin");
Material ureterMaterial = Resources.Load<Material>("Materials/ureter");
Material spleenMaterial = Resources.Load<Material>("Materials/spleen");
Material bloodVesselsMaterial = Resources.Load<Material>("Materials/blood_vessels");
Material heartMaterial = Resources.Load<Material>("Materials/heart");
Material uterusMaterial = Resources.Load<Material>("Materials/uterus_vagina");
Material bladderMaterial = Resources.Load<Material>("Materials/bladder");
Material boneMaterial = Resources.Load<Material>("Materials/bone");
Material urachusMaterial = Resources.Load<Material>("Materials/urachus");
Material ligamentMaterial = Resources.Load<Material>("Materials/ligament");
// Get all child objects of the models parent
Transform[] modelTransforms = modelsParent.GetComponentsInChildren<Transform>();
// Loop through each child object and check its name for a match
foreach (Transform childTransform in modelTransforms)
{
string childName = childTransform.gameObject.name.ToLower();
if (childName.Contains("ve"))
{
// Assign the vein material
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
meshRenderer.material = veinMaterial;
}
else if (childName.Contains("arter"))
{
// Assign the artery material
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
meshRenderer.material = arteryMaterial;
}
else if (childName.Contains("kidney"))
{
// Assign the kidney material
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
meshRenderer.material = kidneyMaterial;
}
else if (childName.Contains("liver"))
{
// Assign the liver material
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
meshRenderer.material = liverMaterial;
}
else if (childName.Contains("back"))
{
// Assign the skin material
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
meshRenderer.material = skinMaterial;
}
else if (childName.Contains("ureter"))
{
// Assign the ureter material
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
meshRenderer.material = ureterMaterial;
}
else if (childName.Contains("spleen"))
{
// Assign the spleen material
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
meshRenderer.material = spleenMaterial;
}
else if (childName.Contains("urachus"))
{
// Assign the blood vessels material
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
meshRenderer.material = urachusMaterial;
}
else if (childName.Contains("ligament"))
{
// Assign the blood vessels material
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
meshRenderer.material = ligamentMaterial;
}
else if (childName.Contains("heart"))
{
// Assign the heart material
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
meshRenderer.material = heartMaterial;
}
else if (childName.Contains("uterus"))
{
// Assign the uterus material
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
meshRenderer.material = uterusMaterial;
}
else if (childName.Contains("bladder"))
{
// Assign the uterus_vagina material
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
meshRenderer.material = bladderMaterial;
}
else if (childName.Contains("iliac") || childName.Contains("femur") || childName.Contains("sacrum") || childName.Contains("cord"))
{
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
meshRenderer.material = boneMaterial;
}
}
}
// Function for extracting the number in the original model name.
private int ExtractNumber(string name)
{
Match match = Regex.Match(name, @"\d+");
if (match.Success)
{
return int.Parse(match.Value);
}
return int.MaxValue; // Return a very large value if no number is found
}
// Function for splitting the canvas screen in two halves.
private void DisplayScreenInTwoHalves()
{
// Create a Canvas GameObject
GameObject canvasObject = new GameObject("Canvas");
Canvas canvas = canvasObject.AddComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
canvasObject.AddComponent<CanvasScaler>();
canvasObject.AddComponent<GraphicRaycaster>();
// Set the Canvas dimensions to cover the entire screen
RectTransform canvasRectTransform = canvas.GetComponent<RectTransform>();
canvasRectTransform.anchorMin = Vector2.zero;
canvasRectTransform.anchorMax = Vector2.one;
canvasRectTransform.offsetMin = Vector2.zero;
canvasRectTransform.offsetMax = Vector2.zero;
// Create a RawImage GameObject as a child of the Canvas
GameObject rawImageObject = new GameObject("RawImage");
rawImageObject.transform.SetParent(canvasObject.transform, false);
RawImage rawImage = rawImageObject.AddComponent<RawImage>();
// Set the RawImage dimensions to cover the right half of the screen
RectTransform rawImageRectTransform = rawImage.GetComponent<RectTransform>();
rawImageRectTransform.anchorMin = new Vector2(0.5f, 0f);
rawImageRectTransform.anchorMax = Vector2.one;
rawImageRectTransform.pivot = new Vector2(0.5f, 0.5f);
rawImageRectTransform.offsetMin = Vector2.zero;
rawImageRectTransform.offsetMax = Vector2.zero;
// Create an empty GameObject and add a VideoPlayer component and CameraSelector script
GameObject cameraObject = new GameObject("CameraObject");
VideoPlayer videoPlayer = cameraObject.AddComponent<VideoPlayer>();
CameraSelector cameraSelector = cameraObject.AddComponent<CameraSelector>();
// Assign the RawImage to the CameraSelector script
cameraSelector.rawImage = rawImage;
// Set the name of the external USB camera to connect
cameraSelector.cameraName = cameraName;
}
// Function for creating the tool tip and assign it as child of Image marker.
//private void ToolTip()
//{
// Create a parent GameObject if it doesn't exist
//if (tipParent == null)
//{
//tipParent = new GameObject("ToolTipParent");
//}
// Create a sphere GameObject
//GameObject tip = GameObject.CreatePrimitive(PrimitiveType.Sphere);
//tip.name = "Tip";
// Set the tag for collisions
//tip.gameObject.tag = "Player";
//tip.transform.localScale = Vector3.one * 10f;
// Set the position of the tip GameObject
//tip.transform.position = new Vector3(12.2f, -35.2f, 27.9f);
// Add Rigidbody component without gravity
//Rigidbody rigidbody = tip.AddComponent<Rigidbody>();
//rigidbody.useGravity = false;
// Add SphereCollider component and set it as a trigger
//SphereCollider sphereCollider = tip.GetComponent<SphereCollider>();
//if (sphereCollider == null)
//{
//sphereCollider = tip.AddComponent<SphereCollider>();
//}
// Check the isTrigger condition
//sphereCollider.isTrigger = true;
// Set the parent of the sphere GameObject
//tip.transform.SetParent(tipParent.transform);
//}
private void MainButton()
{
// Create a Canvas GameObject
GameObject canvasObject = new GameObject("CanvasShowOrgans");
Canvas canvas = canvasObject.AddComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
canvasObject.AddComponent<CanvasScaler>();
canvasObject.AddComponent<GraphicRaycaster>();
// Set the Canvas dimensions to cover the entire screen
RectTransform canvasRectTransform = canvas.GetComponent<RectTransform>();
canvasRectTransform.anchorMin = Vector2.zero;
canvasRectTransform.anchorMax = Vector2.one;
canvasRectTransform.offsetMin = Vector2.zero;
canvasRectTransform.offsetMax = Vector2.zero;
// Create a Button GameObject as a child of the Canvas
GameObject buttonObject = new GameObject("MainButton");
buttonObject.transform.SetParent(canvasObject.transform, false);
RectTransform buttonRectTransform = buttonObject.AddComponent<RectTransform>();
// Set the position and size of the button
buttonRectTransform.anchorMin = new Vector2(0f, 1f);
buttonRectTransform.anchorMax = new Vector2(0f, 1f);
buttonRectTransform.pivot = new Vector2(0f, 1f);
buttonRectTransform.anchoredPosition = Vector2.zero;
buttonRectTransform.sizeDelta = new Vector2(200f, 50f);
// Add the Button component to the button GameObject
Button buttonComponent = buttonObject.AddComponent<Button>();
// Add a Text component to the button GameObject and set its properties
GameObject textObject = new GameObject("Text");
textObject.transform.SetParent(buttonObject.transform, false);
RectTransform textRectTransform = textObject.AddComponent<RectTransform>();
Text textComponent = textObject.AddComponent<Text>();
textComponent.text = "Hide organs";
textComponent.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
textComponent.fontStyle = FontStyle.Bold; // Set the font style to bold
textComponent.alignment = TextAnchor.MiddleCenter;
textComponent.color = Color.white;
// Set the position and size of the text
textRectTransform.anchorMin = Vector2.zero;
textRectTransform.anchorMax = Vector2.one;
textRectTransform.pivot = new Vector2(0.5f, 0.5f);
textRectTransform.anchoredPosition = Vector2.zero;
textRectTransform.sizeDelta = Vector2.zero;
// Set the text font size based on the button size
float fontSize = buttonRectTransform.sizeDelta.y * 0.5f;
textComponent.fontSize = Mathf.FloorToInt(fontSize);
// Add a yellow Image component to the button GameObject
Image buttonImage = buttonObject.AddComponent<Image>();
buttonImage.color = new Color(0.12f, 0.44f, 0.93f); // Set the color to 0C6FEE (hex) or (12, 111, 238) (RGB)
// Add an onClick event to the button to call the ToggleModels function
buttonComponent.onClick.AddListener(ToggleModels);
// Assign the MainButton to the buttonObject
mainButton = buttonObject;
// Set the parent of the button GameObject
buttonObject.transform.SetParent(canvasObject.transform, false);
}
// Function for toggling the visibility of the models
private void ToggleModels()
{
// Toggle the visibility of the models
areModelsShown = !areModelsShown;
// Get all child objects of the models parent
Transform[] modelTransforms = modelsParent.GetComponentsInChildren<Transform>();
// Loop through each child object and toggle the MeshRenderer component
foreach (Transform childTransform in modelTransforms)
{
MeshRenderer meshRenderer = childTransform.GetComponent<MeshRenderer>();
if (meshRenderer != null)
{
string modelName = childTransform.name;
if(modelName.Contains("marker"))
{
meshRenderer.enabled = true;
}
else
{ // If the organs are hidden
if (areModelsShown == false)
{
meshRenderer.enabled = areModelsShown;
// Add the "OrganCollision" script to the models.
OrganCollision organCollision = childTransform.gameObject.AddComponent<OrganCollision>();
}
else
{ // If the organs are shown, disable the collider.
meshRenderer.enabled = areModelsShown;
// Remove the "OrganCollision" script from the models if it exists
OrganCollision organCollision = childTransform.gameObject.GetComponent<OrganCollision>();
if (organCollision != null)
{
Destroy(organCollision);
}
}
}
}
}
// Update the button text and color
Text buttonText = mainButton.GetComponentInChildren<Text>();
buttonText.text = areModelsShown ? "Hide organs" : "Show organs";
Image buttonImage = mainButton.GetComponent<Image>();
if (areModelsShown)
{
buttonImage.color = new Color(0.12f, 0.44f, 0.93f); // Set the color to 0C6FEE (hex) or (12, 111, 238) (RGB)
}
else
{
buttonImage.color = new Color(0.96f, 0.18f, 0.27f); // Set the color to F62E46 (hex) or (246, 46, 70) (RGB)
}
}
// Method to create and configure the change view button
private void CreateChangeViewButton()
{
// Create a Canvas GameObject
GameObject canvasObject = new GameObject("CanvasView");
Canvas canvas = canvasObject.AddComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
canvasObject.AddComponent<CanvasScaler>();
canvasObject.AddComponent<GraphicRaycaster>();
// Set the Canvas dimensions to cover the entire screen
RectTransform canvasRectTransform = canvas.GetComponent<RectTransform>();
canvasRectTransform.anchorMin = Vector2.zero;
canvasRectTransform.anchorMax = Vector2.one;
canvasRectTransform.offsetMin = Vector2.zero;
canvasRectTransform.offsetMax = Vector2.zero;
// Create a Button GameObject as a child of the Canvas
GameObject buttonObject = new GameObject("Change view button 2");
buttonObject.transform.SetParent(canvasObject.transform, false);
RectTransform buttonRectTransform = buttonObject.AddComponent<RectTransform>();
// Set the position and size of the button
buttonRectTransform.anchorMin = new Vector2(0f, 1f);
buttonRectTransform.anchorMax = new Vector2(0f, 1f);
buttonRectTransform.pivot = new Vector2(0f, 1f);
buttonRectTransform.position = new Vector3(250f, -470f, 0f);
buttonRectTransform.sizeDelta = new Vector2(200f, 30f);
// Add the Button component to the button GameObject
Button buttonComponent = buttonObject.AddComponent<Button>();
// Add a Text component to the button GameObject and set its properties
GameObject textObject = new GameObject("Text");
textObject.transform.SetParent(buttonObject.transform, false);
RectTransform textRectTransform = textObject.AddComponent<RectTransform>();
Text textComponent = textObject.AddComponent<Text>();
textComponent.text = "Change to Sagittal View";
textComponent.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
textComponent.fontStyle = FontStyle.Bold; // Set the font style to bold
textComponent.alignment = TextAnchor.MiddleCenter;
textComponent.color = Color.white;
// Set the position and size of the text
textRectTransform.anchorMin = Vector2.zero;
textRectTransform.anchorMax = Vector2.one;
textRectTransform.pivot = new Vector2(0.5f, 0.5f);
textRectTransform.anchoredPosition = Vector2.zero;
textRectTransform.sizeDelta = Vector2.zero;
// Set the text font size based on the button size
float fontSize = buttonRectTransform.sizeDelta.y * 0.5f;
textComponent.fontSize = Mathf.FloorToInt(fontSize);
// Add a yellow Image component to the button GameObject
Image buttonImage = buttonObject.AddComponent<Image>();
buttonImage.color = Color.blue;
// Assign the MainButton to the buttonObject
changeViewButton = buttonObject;
// Set the parent of the button GameObject
buttonObject.transform.SetParent(canvasObject.transform, false);
// Add an onClick event to the button to call the ToggleModels function
buttonComponent.onClick.AddListener(ToggleModelsFolderPath);
buttonComponent.onClick.AddListener(() => DestroyChildObjects(modelsParent.transform));
// Add a button click event listener
buttonComponent.onClick.AddListener(LoadModels);
buttonComponent.onClick.AddListener(AddMaterial);
buttonComponent.onClick.AddListener(DestroyCanvasObject);
buttonComponent.onClick.AddListener(MainButton);
}
// Method to toggle between models folder paths when the button is clicked, activating and deactivating tool gameobjects and changing the color and text of the button previously created.
private void ToggleModelsFolderPath()
{
// Toggle the flag between the alternative path and the default path
isAlternativePath = !isAlternativePath;
// Get the Text component of the button
Text textComponent = changeViewButton.GetComponentInChildren<Text>();
// Get the Image component of the button
Image buttonImage = changeViewButton.GetComponent<Image>();
// Update the models folder path based on the current state
if (isAlternativePath)
{
UpdateModelsFolderPath(SagittalModelsFolderPath);
// Activate the sagittal game object and its children
sagittalGameObject.SetActive(true);
// Deactivate the coronal game object and its children
coronalGameObject.SetActive(false);
// Change the text
textComponent.text = "Change to Coronal View";
// Change the color
buttonImage.color = Color.magenta;
}
else
{
UpdateModelsFolderPath(CoronalModelsFolderPath);
// Activate the coronal game object and its children
coronalGameObject.SetActive(true);
// Deactivate the sagittal game object and its children
sagittalGameObject.SetActive(false);
// Change the text
textComponent.text = "Change to Sagittal View";
// Change the color
buttonImage.color = Color.blue;
}
}
// Method to update models folder path and reload models
public void UpdateModelsFolderPath(string newPath)
{
modelsFolderPath = newPath;
LoadModels();
}
public void DestroyChildObjects(Transform parentTransform)
{
// Get all child objects of the parent
Transform[] childTransforms = parentTransform.GetComponentsInChildren<Transform>();
// Loop through each child transform
foreach (Transform childTransform in childTransforms)
{
// Exclude the parent and the child object containing "marker" from destruction
if (childTransform != parentTransform && !childTransform.name.Contains("marker"))
{
// Destroy the child gameobject
Destroy(childTransform.gameObject);
}
}
}
public void DestroyCanvasObject()
{
GameObject canvasObject = GameObject.Find("CanvasShowOrgans");
Destroy(canvasObject);
}
}