GetPrefabInstanceNameFromActor

Definition

string GetPrefabInstanceNameFromActor(string physicsActorName)

Description

This function receives the physics actor physicsActorName and returns the name of the prefab instance to which physicsActorName belongs.

Parameters

physicsActorName
Specifies the name of the physics actor.

Return Value

This function returns the name of the prefab instance to which physicsActorName belongs.

Example

prefab_instance_name = ""

function OnTriggerEnter(otherActorName)
    prefab_instance_name = GetPrefabInstanceNameFromActor(otherActorName)

    message = string.format("\nPrefab instance name is > %s" ,prefab_instance_name)
    PrintConsole(message)
end

function OnTriggerStay(otherActorName)

end

function OnTriggerExit(otherActorName)

end
Assume that this script is attached to a trigger. Whenever a prefab instance that has dynamic physics is entered into this trigger, the name of its physics actor is sent to the OnTriggerEnter event. Using the GetPrefabInstanceNameFromActor function, we find the prefab instance name that otherActorName name belongs to and display it in the console.
adminGetPrefabInstanceNameFromActor