Resource.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. using System.Runtime.CompilerServices;
  5. namespace BansheeEngine
  6. {
  7. /// <summary>
  8. /// Base class for all resources. Resources can be persistently referenced by scene objects or other resources.
  9. /// </summary>
  10. public class Resource : ScriptObject
  11. {
  12. /// <summary>
  13. /// Name of the resource. Use primarily for easier identification and not important to the engine itself.
  14. /// </summary>
  15. public string Name
  16. {
  17. get { return Internal_GetName(mCachedPtr); }
  18. }
  19. /// <summary>
  20. /// Returns a universally unique identifier of this resource.
  21. /// </summary>
  22. public string UUID
  23. {
  24. get { return Internal_GetUUID(mCachedPtr); }
  25. }
  26. /// <summary>
  27. /// Releases an internal reference to the resource held by the resources system. <see cref="Resources.Release"/>
  28. /// </summary>
  29. public void Release()
  30. {
  31. Internal_Release(mCachedPtr);
  32. }
  33. [MethodImpl(MethodImplOptions.InternalCall)]
  34. private static extern string Internal_GetName(IntPtr nativeInstance);
  35. [MethodImpl(MethodImplOptions.InternalCall)]
  36. private static extern string Internal_GetUUID(IntPtr nativeInstance);
  37. [MethodImpl(MethodImplOptions.InternalCall)]
  38. private static extern void Internal_Release(IntPtr nativeInstance);
  39. }
  40. }