Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for game object in active set component.
- Loading branch information
Showing
3 changed files
with
36 additions
and
25 deletions.
There are no files selected for viewing
25 changes: 0 additions & 25 deletions
25
Assets/Plugins/ARFoundation-Components/Scripts/ARSetEnabledStateOfComponentsOnEvent.cs
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
Assets/Plugins/ARFoundation-Components/Scripts/SetEnabledStateOfObjectsOnEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using UnityEngine; | ||
|
||
namespace CandyCoded.ARFoundationComponents | ||
{ | ||
|
||
public class SetEnabledStateOfObjectsOnEvent : MonoBehaviour | ||
{ | ||
|
||
public Object[] objects; | ||
|
||
public void SetEnabledStateOfObjects(bool enabledState) | ||
{ | ||
|
||
foreach (var obj in objects) | ||
{ | ||
|
||
if (obj is MonoBehaviour) | ||
{ | ||
|
||
((MonoBehaviour)obj).enabled = enabledState; | ||
|
||
} | ||
else if (obj is GameObject) | ||
{ | ||
|
||
((GameObject)obj).SetActive(enabledState); | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
} |
File renamed without changes.