Table of Contents

Class OnGameObjectCreatedAttribute

Namespace
Nautilus.Options.Attributes
Assembly
Nautilus.dll
Attribute used to signify a method to call whenever the UnityEngine.GameObject for the OptionItem corresponding to the decorated member is created.
[AttributeUsage(AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = true)]
public sealed class OnGameObjectCreatedAttribute : ModOptionEventAttribute, _Attribute
Inheritance
OnGameObjectCreatedAttribute
Implements
Inherited Members
Extension Methods

Examples

using Nautilus.Json;
using Nautilus.Options;
using QModManager.Utility;
using UnityEngine;

[Menu("Nautilus Example Mod")]
public class Config : ConfigFile
{
    [Toggle("My checkbox"), OnGameObjectCreated(nameof(MyGameObjectCreatedEvent))]
    public bool ToggleValue;

    private void MyGameObjectCreatedEvent(GameObjectCreatedEventArgs e)
   {
       Logger.Log(Logger.Level.Info, "GameObject was created");
       Logger.Log(Logger.Level.Info, $"{e.Id}: {e.GameObject}");
   }
}

Remarks

The method must be a member of the same class. Can be specified multiple times to call multiple methods.

The specified method can optionally take the following parameters in any order:
- object sender: The sender of the event
- EventArgs eventArgs: The generalized event arguments of the event
- GameObjectCreatedEventArgs gameObjectCreatedEventArgs: The GameObjectCreatedEventArgs for the event

Constructors

OnGameObjectCreatedAttribute(string)

Signifies a method to call whenever the UnityEngine.GameObject for the OptionItem corresponding to the decorated member is created.
public OnGameObjectCreatedAttribute(string methodName)

Parameters

methodName string
The name of the method within the same class to invoke.

Remarks

The method must be a member of the same class.

See Also