forked from jbruening/unity3d-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComponentExtensions.cs
More file actions
29 lines (28 loc) · 822 Bytes
/
ComponentExtensions.cs
File metadata and controls
29 lines (28 loc) · 822 Bytes
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace UEx
{
/// <summary>
///
/// </summary>
public static class MonoBehaviourExtensions
{
/// <summary>
/// disable the specified behaviour if the assertvalue is false, and throw a warning
/// </summary>
/// <param name="behaviour"></param>
/// <param name="assertValue"></param>
/// <param name="message"></param>
public static void Assert(this MonoBehaviour behaviour, bool assertValue, string message = "")
{
if (!assertValue)
{
Debug.LogWarning("Assert failed. " + message);
behaviour.enabled = false;
}
}
}
}