Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can only destroy an instance that was created via SpawnedObject. If you want to get rid of something that was built-into the scene try changing its "Visibility" Bool Property, use either a No-Code Component or with a PostBoolPropertyUpdate.

- Sample

Code Block
languagec#
using CavrnusSdk.API;
using CavrnusSdk;
using UnityEngine;

public class DestroyObject : MonoBehaviour
{
    public void DestroyMe()
    {
        if (GetComponent<CavrnusSpawnedObjectFlag>() == null)
            Debug.LogError("This object was not spawned via Cavrnus, cannot destroy it");

        CavrnusSpawnedObject spawnedObject = GetComponent<CavrnusSpawnedObjectFlag>().SpawnedObject;

        spawnedObject.DestroyObject();
    }
}//Coming Soon