diff --git a/Source/Editor/Surface/Archetypes/Tools.cs b/Source/Editor/Surface/Archetypes/Tools.cs index 52ffbb5cb..15f2b15b8 100644 --- a/Source/Editor/Surface/Archetypes/Tools.cs +++ b/Source/Editor/Surface/Archetypes/Tools.cs @@ -672,6 +672,24 @@ namespace FlaxEditor.Surface.Archetypes } } + private class ThisNode : SurfaceNode + { + /// + public ThisNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch) + : base(id, context, nodeArch, groupArch) + {} + + /// + public override void OnLoaded() + { + base.OnLoaded(); + var vss = (VisualScriptSurface)this.Context.Surface; + var type = TypeUtils.GetType(vss.Script.ScriptTypeName); + var box = (OutputBox)GetBox(0); + box.CurrentType = type ? type : new ScriptType(typeof(VisualScript)); + } + } + private class AssetReferenceNode : SurfaceNode { /// @@ -1366,6 +1384,7 @@ namespace FlaxEditor.Surface.Archetypes { TypeID = 19, Title = "This Instance", + Create = (id, context, arch, groupArch) => new ThisNode(id, context, arch, groupArch), Description = "Gets the reference to this script object instance (self).", Flags = NodeFlags.VisualScriptGraph, Size = new Vector2(140, 20),