The structure that wraps the script type with support for native C++ scripts, managed C# scripts, Visual Scripts and custom scripts.
| 714 | /// The structure that wraps the script type with support for native C++ scripts, managed C# scripts, Visual Scripts and custom scripts. |
| 715 | /// </summary> |
| 716 | [HideInEditor] |
| 717 | public readonly struct ScriptType : IEquatable<ScriptType> |
| 718 | { |
| 719 | private readonly Type _managed; |
| 720 | private readonly IScriptType _custom; |
| 721 | |
| 722 | /// <summary> |
| 723 | /// A <see cref="ScriptType" /> that is null (invalid). |
| 724 | /// </summary> |
| 725 | public static readonly ScriptType Null; |
| 726 | |
| 727 | /// <summary> |
| 728 | /// A <see cref="ScriptType" /> that is System.Void. |
| 729 | /// </summary> |
| 730 | public static readonly ScriptType Void = new ScriptType(typeof(void)); |
| 731 | |
| 732 | /// <summary> |
| 733 | /// A <see cref="ScriptType" /> that is System.Object. |
| 734 | /// </summary> |
| 735 | public static readonly ScriptType Object = new ScriptType(typeof(object)); |
| 736 | |
| 737 | /// <summary> |
| 738 | /// A <see cref="ScriptType" /> that is FlaxEngine.Object. |
| 739 | /// </summary> |
| 740 | public static readonly ScriptType FlaxObject = new ScriptType(typeof(FlaxEngine.Object)); |
| 741 | |
| 742 | /// <summary> |
| 743 | /// Gets the type of the script as <see cref="System.Type"/>. |
| 744 | /// </summary> |
| 745 | public Type Type => _managed; |
| 746 | |
| 747 | /// <summary> |
| 748 | /// Gets the type of the script as <see cref="FlaxEditor.Scripting.IScriptType"/>. |
| 749 | /// </summary> |
| 750 | public IScriptType IScriptType => _custom; |
| 751 | |
| 752 | /// <summary> |
| 753 | /// Gets a type display name (eg. name of the class or enum without leading namespace). |
| 754 | /// </summary> |
| 755 | public string Name |
| 756 | { |
| 757 | get |
| 758 | { |
| 759 | if (_custom != null) |
| 760 | return _custom.Name; |
| 761 | if (_managed == null) |
| 762 | return string.Empty; |
| 763 | return _managed.GetTypeDisplayName(); |
| 764 | } |
| 765 | } |
| 766 | |
| 767 | /// <summary> |
| 768 | /// Gets a full namespace of the type. |
| 769 | /// </summary> |
| 770 | public string Namespace => _managed?.Namespace ?? _custom?.Namespace; |
| 771 | |
| 772 | /// <summary> |
| 773 | /// Gets a full name of the type including leading namespace and any nested types names. Uniquely identifies the type and can be used to find it via <see cref="TypeUtils.GetType(string)"/>. |
nothing calls this directly
no test coverage detected