Astra Unity 2.6.6
Astra Unity Plugin
Astra.Asset.MaterialItem Class Reference

Wraps a Unity Material that is attached to a Compound Item This class maintains references to materials and textures for you More...

Inheritance diagram for Astra.Asset.MaterialItem:

Public Member Functions

void SetReferencedItems (bool referenced)
 Used to override the internal check for ReferenceItems and DereferenceItems This is ONLY useful if you're procedurally creating these assets yourself This will set the internal cache flag for reference counting w/o changing references More...
 
void ReferenceItems (bool force=false)
 Ensure that we increment the reference count for objects tied to this MaterialItem. This is necessary if the MaterialItem is created outside the normal processes, such as being cloned from an existing Material. More...
 
void DereferenceItems ()
 Inverses reference counts for things like textures
 
void OnBeforeSceneSerialize ()
 Fired before a scene is saved in the Unity Editor NOTE: this is never fired in runtime builds More...
 
void OnAfterSceneDeserialize ()
 Fired after a scene has loaded NOTE: this IS fired in both the Unity Editor and runtime builds More...
 
bool IsSceneSerialized ()
 Tells the system if the object has been serialized or not. This should report True if and only if OnBeforeSceneSerialize was triggered and serialized and it has not yet been deserialized More...
 
- Public Member Functions inherited from Astra.Asset.ItemBase
virtual CompoundItem FindParentCompound ()
 Find the parent CompoundItem which this Item is attached to, if it exists, otherwise null
 
virtual AvatarItem FindAvatarItem ()
 Returns the AvatarItem this item is attached to (if found, note may return null)
 
virtual RigItem FindRigItem ()
 Finds the current RigItem associated on this Avatar Hierarchy More...
 

Public Attributes

bool DestroyTexturesOnDestroy = true
 Whether the wrapped Unity Material should be freed when this class is freed
 
MaterialTarget materialTarget
 Stores representations of a material as meta data blocks.
 
SerializableDictionarySS TextureMap = new SerializableDictionarySS()
 Key is texture channel slot (eg: _MainTex), value is GUID of texture, eg: 123-456-abc
 

Protected Member Functions

string GetUniqueMaterialId ()
 
- Protected Member Functions inherited from Astra.Asset.ItemBase
void TrackId (string id)
 
void UntrackIds ()
 

Protected Attributes

int _unityInstanceId = 0
 We need to use these so we know if we're a copy, if we are we'll generate a new set of references
 
bool _referencedItems = false
 
bool _isSceneSerialized = false
 
- Protected Attributes inherited from Astra.Asset.ItemBase
List< string > _trackingIds = null
 

Static Protected Attributes

static List< string > _proceduralTextureProperties
 

Properties

Material UnityMaterial [getset]
 Unity Material that this item wraps
 
- Properties inherited from Astra.Asset.ItemBase
virtual McsSdk20.Primitives.AstraPrimitiveType PrimitiveType [get]
 Retrieve the primitive type for this item
 
virtual McsSdk20.Primitives.SchematicType SchematicType [get]
 Retrieve the schematic type for this item
 
string AstraGuid [getset]
 Guid for this item to identify it in the Astra Service
 
string AstraName [getset]
 Display name for this item
 
string AstraInstanceId [getset]
 Guid representing an instance of this item
 
- Properties inherited from Astra.Asset.IAstraBaseInterface
string AstraGuid [getset]
 
string AstraName [getset]
 
string AstraInstanceId [getset]
 

Detailed Description

Wraps a Unity Material that is attached to a Compound Item This class maintains references to materials and textures for you

Member Function Documentation

◆ IsSceneSerialized()

bool Astra.Asset.MaterialItem.IsSceneSerialized ( )
inline

Tells the system if the object has been serialized or not. This should report True if and only if OnBeforeSceneSerialize was triggered and serialized and it has not yet been deserialized

Returns
True if we've manipulated the object for scene saving, false otherwise

Implements Astra.Asset.ISceneSerializable.

◆ OnAfterSceneDeserialize()

void Astra.Asset.MaterialItem.OnAfterSceneDeserialize ( )
inline

Fired after a scene has loaded NOTE: this IS fired in both the Unity Editor and runtime builds

Implements Astra.Asset.ISceneSerializable.

◆ OnBeforeSceneSerialize()

void Astra.Asset.MaterialItem.OnBeforeSceneSerialize ( )
inline

Fired before a scene is saved in the Unity Editor NOTE: this is never fired in runtime builds

Implements Astra.Asset.ISceneSerializable.

◆ ReferenceItems()

void Astra.Asset.MaterialItem.ReferenceItems ( bool  force = false)
inline

Ensure that we increment the reference count for objects tied to this MaterialItem. This is necessary if the MaterialItem is created outside the normal processes, such as being cloned from an existing Material.

Parameters
forceIf true, will increase references even if already set

◆ SetReferencedItems()

void Astra.Asset.MaterialItem.SetReferencedItems ( bool  referenced)
inline

Used to override the internal check for ReferenceItems and DereferenceItems This is ONLY useful if you're procedurally creating these assets yourself This will set the internal cache flag for reference counting w/o changing references

Parameters
referenced

Member Data Documentation

◆ _proceduralTextureProperties

List<string> Astra.Asset.MaterialItem._proceduralTextureProperties
staticprotected
Initial value:
= new List<string>(){
"_AlphaTex",
"_DecalTex",
"_DecalNormal",
"_DecalGlossMap",
}

The documentation for this class was generated from the following file: