DecalCreator.CreateDynamicSkinnedDecal (UnityEngine.Mesh, UnityEngine.GameObject, Frameshift.Decal.DecalType, UnityEngine.Material) Method

DecalFramework

DropDown image DropDownHover image Collapse image Expand image CollapseAll image ExpandAll image Copy image CopyHover image

Create dynamic skinned Decal GameObject with material override

Namespace: Frameshift.Decal
Assembly: Frameshift.Decal (in Frameshift.Decal.dll)

Expand  imageSyntax

C#
public static GameObject CreateDynamicSkinnedDecal( 
Mesh decalMesh
GameObject obj
DecalType decalType
Material materialOverride 
);

Parameters

decalMesh

Decal mesh in world space

obj

GameObject with SkinnedMeshRenderer attached

decalType

Type of this Decal

materialOverride

Material override for Decal

Return Value

DecalExpeditor for this decalType on this obj

Expand image Example

 CopyCode imageCopy Code
 
RaycastHit hit; 
Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0)); 
bool wasHit = Physics.Raycast(ray, out hit); 
if (wasHit) 

//If we hit character 
if (hit.collider.transform.root.name == "Enemy") 

//Find SkinnedMeshRenderer 
SkinnedMeshRenderer smr = hit.collider.transform.root.GetComponentInChildren<SkinnedMeshRenderer>(); 
//Burn DecalMesh 
Mesh decalMesh=DecalCreator.CreateDecalMesh(i_blood, hit.point, -hit.normal, smr.gameObject, Vector3.zero); 
//Create Skinned Decal 
DecalCreator.CreateDynamicSkinnedDecal(decalMesh, smr.gameObject, i_blood); 

}

Expand image Platforms

Unity 2.6.1

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Expand image See Also