mirror of
https://github.com/AnnulusGames/Alchemy.git
synced 2025-01-22 08:18:51 -05:00
Update: README
This commit is contained in:
parent
cf339a60a9
commit
9dd5d44f0a
27
README.md
27
README.md
@ -338,6 +338,33 @@ public partial class AlchemySerializationSample : MonoBehaviour
|
|||||||
|
|
||||||
<img src="https://github.com/AnnulusGames/Alchemy/blob/main/Alchemy/Assets/Alchemy/Documentation~/img6.png" width="600">
|
<img src="https://github.com/AnnulusGames/Alchemy/blob/main/Alchemy/Assets/Alchemy/Documentation~/img6.png" width="600">
|
||||||
|
|
||||||
|
## Extending AlchemyEditor
|
||||||
|
|
||||||
|
When a MonoBehaviour or ScriptableObject has its own Editor class, Alchemy attributes won't function as expected. If you wish to combine custom editor extensions with Alchemy, you need to inherit from the `AlchemyEditor` class rather than the `UnityEngine.Editor` class.
|
||||||
|
|
||||||
|
```cs
|
||||||
|
using UnityEditor;
|
||||||
|
using Alchemy.Editor;
|
||||||
|
|
||||||
|
[CustomEditor(typeof(Example))]
|
||||||
|
public class EditorExample : AlchemyEditor
|
||||||
|
{
|
||||||
|
public override VisualElement CreateInspectorGUI()
|
||||||
|
{
|
||||||
|
// Always call the base class's CreateInspectorGUI
|
||||||
|
base.CreateInspectorGUI();
|
||||||
|
|
||||||
|
// Add your custom logic here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Disabling Default Editor
|
||||||
|
|
||||||
|
By default, Alchemy uses its own Editor class to render all types. However, it's possible to disable this behavior to avoid conflicts with other libraries or assets.
|
||||||
|
|
||||||
|
To disable the default editor, add `ALCHEMY_DISABLE_DEFAULT_EDITOR` to `Project Settings > Player > Scripting Define Symbols`. When this is added, if you want to use Alchemy's features, you'll need to define your custom Editor class inheriting from `AlchemyEditor`.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[MIT License](LICENSE)
|
[MIT License](LICENSE)
|
27
README_JA.md
27
README_JA.md
@ -338,6 +338,33 @@ public partial class AlchemySerializationSample : MonoBehaviour
|
|||||||
|
|
||||||
<img src="https://github.com/AnnulusGames/Alchemy/blob/main/Alchemy/Assets/Alchemy/Documentation~/img6.png" width="600">
|
<img src="https://github.com/AnnulusGames/Alchemy/blob/main/Alchemy/Assets/Alchemy/Documentation~/img6.png" width="600">
|
||||||
|
|
||||||
|
## AlchemyEditorを拡張する
|
||||||
|
対象のMonoBehaviourやScriptableObjectが独自のEditorクラスを持つ場合、Alchemyの属性は動作しません。
|
||||||
|
独自のエディタ拡張とAlchemyを組み合わせたい場合には、`UnityEngine.Editor`クラスではなく`AlchemyEditor`クラスを継承する必要があります。
|
||||||
|
|
||||||
|
```cs
|
||||||
|
using UnityEditor;
|
||||||
|
using Alchemy.Editor;
|
||||||
|
|
||||||
|
[CustomEditor(typeof(Example))]
|
||||||
|
public class EditorExample : AlchemyEditor
|
||||||
|
{
|
||||||
|
public override VisualElement CreateInspectorGUI()
|
||||||
|
{
|
||||||
|
// 必ず継承元のCreateInspectorGUIを呼び出す
|
||||||
|
base.CreateInspectorGUI();
|
||||||
|
|
||||||
|
// ここに独自の処理を記述する
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## デフォルトのエディタを無効化する
|
||||||
|
|
||||||
|
デフォルトではAlchemyでは独自のEditorクラスを使用して全ての型の描画を行います。ただし、他ライブラリやアセットとの競合を避けるためこれを無効化することもできます。
|
||||||
|
|
||||||
|
デフォルトのエディタを無効化するには、`Project Settings > Player > Scripting Define Symbols`の項目に`ALCHEMY_DISABLE_DEFAULT_EDITOR`を追加します。これを追加した状態でAlchemyの機能を使用したい場合には、`AlchemyEditor`を継承した独自のEditorクラスを定義する必要があります。
|
||||||
|
|
||||||
## ライセンス
|
## ライセンス
|
||||||
|
|
||||||
[MIT License](LICENSE)
|
[MIT License](LICENSE)
|
||||||
|
Loading…
Reference in New Issue
Block a user