Skip to content

Commit

Permalink
Add invisible component example
Browse files Browse the repository at this point in the history
  • Loading branch information
nowsprinting committed Oct 29, 2023
1 parent 01bf967 commit 4916c12
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Assets/BasicExample/Tests/Runtime/Components.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions Assets/BasicExample/Tests/Runtime/Components/TestSpyComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) 2021-2023 Koji Hasegawa.
// This software is released under the MIT License.

using UnityEngine;

namespace BasicExample.Components
{
/// <summary>
/// テスト内で使用するコンポーネントの例.
/// テストアセンブリにあってもインスペクターの "Add Component" ピッカーで検索できてしまうが、
/// <c>AddComponentMenuAttribute</c> に "" を渡すことで非表示にできる。
/// </summary>
[AddComponentMenu("")] // Hide from "Add Component" picker
public class TestSpyComponent : MonoBehaviour
{
/// <summary>
/// <c>Awake</c> が呼ばれた
/// </summary>
public bool IsAwakeCalled { get; private set; } = false;

/// <summary>
/// <c>Start</c> が呼ばれた
/// </summary>
public bool IsStartCalled { get; private set; } = false;

private void Awake()
{
IsAwakeCalled = true;
}

private void Start()
{
IsStartCalled = true;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4916c12

Please sign in to comment.