| ASLHelperInstantiateASLObject Method (String, Vector3, Quaternion, String, String, ASLObjectASLGameObjectCreatedCallback, ASLObjectClaimCancelledRecoveryCallback) |
Create an ASL Object - make sure the prefab you are using to create this ASLObject with does NOT already have an ASL script attached to it
and that it exists on all user's devices (that it can be found on all devices)
Namespace:
ASL
Assembly:
Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax public static void InstantiateASLObject(
string _prefabName,
Vector3 _position,
Quaternion _rotation,
string _parentID,
string _componentAssemblyQualifiedName,
ASLObjectASLGameObjectCreatedCallback _aslGameObjectCreatedCallbackInfo,
ASLObjectClaimCancelledRecoveryCallback _aslClaimCancelledRecoveryFunctionInfo
)
Public Shared Sub InstantiateASLObject (
_prefabName As String,
_position As Vector3,
_rotation As Quaternion,
_parentID As String,
_componentAssemblyQualifiedName As String,
_aslGameObjectCreatedCallbackInfo As ASLObjectASLGameObjectCreatedCallback,
_aslClaimCancelledRecoveryFunctionInfo As ASLObjectClaimCancelledRecoveryCallback
)
public:
static void InstantiateASLObject(
String^ _prefabName,
Vector3 _position,
Quaternion _rotation,
String^ _parentID,
String^ _componentAssemblyQualifiedName,
ASLObjectASLGameObjectCreatedCallback^ _aslGameObjectCreatedCallbackInfo,
ASLObjectClaimCancelledRecoveryCallback^ _aslClaimCancelledRecoveryFunctionInfo
)
static member InstantiateASLObject :
_prefabName : string *
_position : Vector3 *
_rotation : Quaternion *
_parentID : string *
_componentAssemblyQualifiedName : string *
_aslGameObjectCreatedCallbackInfo : ASLObjectASLGameObjectCreatedCallback *
_aslClaimCancelledRecoveryFunctionInfo : ASLObjectClaimCancelledRecoveryCallback -> unit
Parameters
- _prefabName
- Type: SystemString
The name of the prefab to be instantiated. Make sure your prefab is located in the Resources/MyPrefabs folder so it can be found - _position
- Type: Vector3
The position where the object will be instantiated - _rotation
- Type: Quaternion
The rotation orientation of the object to be instantiated - _parentID
- Type: SystemString
The id or name of the parent object for this instantiated object - _componentAssemblyQualifiedName
- Type: SystemString
The full name of the component to be added to this object upon creation. - _aslGameObjectCreatedCallbackInfo
- Type: ASLASLObjectASLGameObjectCreatedCallback
This is the function that you want to be called after object creation - _aslClaimCancelledRecoveryFunctionInfo
- Type: ASLASLObjectClaimCancelledRecoveryCallback
This is the function that you want to be called whenever a claim is rejected/cancelled
Examples void SomeFunction()
{
ASL.ASLHelper.InstantiateASLObject("MyPrefab", new Vector3(0, 0, 0), Quaternion.identity, gameobject.GetComponent<ASL.ASLObject>().m_Id,
"MyNamespace.MyClass",
MyUponInstantiationFunction,
MyClaimRejectedFunction);
}
public static void MyUponInstantiationFunction(GameObject _myGameObject)
{
Debug.Log("Caller-Object ID: " + _myGameObject.GetComponent<ASL.ASLObject>().m_Id);
}
public static void MyClaimRejectedFunction(string _id, int _cancelledCallbacks)
{
Debug.LogWarning("We are going to cancel " + _cancelledCallbacks +
" callbacks generated by a claim for object: " + _id + " rather than try to recover.");
}
See Also