Show / Hide Table of Contents

Class ImportedComponentAttribute

Defines a Component provided by a mod assembly which can be automatically serialized and deserialized.

Inheritance
Object
Attribute
ImportedComponentAttribute
Namespace: DaggerfallWorkshop.Game.Utility.ModSupport
Assembly: Assembly-CSharp.dll
Syntax
[AttributeUsage(AttributeTargets.Class)]
public class ImportedComponentAttribute : Attribute, _Attribute
Remarks

Monobehaviours defined in a mod assembly are not known to Unity when a prefab is loaded and deserialized from an assetbundle. If a prefab is marked with this attribute, the bundled clone is stripped of any instance of the Monobehaviour and its data is stored in a json file bundled with the mod. When the GameObject is loaded at runtime, the json file is used to automatically add back the components (provided by the mod assembly) and deserialize them.

Methods

| Improve this Doc View Source

MakeFileName(String)

Makes the filename for the imported components data.

Declaration
public static string MakeFileName(string prefabName)
Parameters
Type Name Description
String prefabName
Returns
Type Description
String
| Improve this Doc View Source

Restore(Mod, GameObject, String)

Restore imported components on this gameobject and its children.

Declaration
public static void Restore(Mod mod, GameObject gameObject, string assetname)
Parameters
Type Name Description
Mod mod

The mod that contains components type and serialized data.

GameObject gameObject

A gameobject instance.

String assetname

Persistent and unique assetname inside the mod.

  • Improve this Doc
  • View Source
In This Article
  • Methods
    • MakeFileName(String)
    • Restore(Mod, GameObject, String)
Back to top Generated by DocFX