+4

C# custom node

nikl75 3 years ago updated by Mary 9 months ago 1

hi there,


for several hours I tried to wrap my head around – no result. I'm trying to integrate the touchscript-asset (https://github.com/TouchScript/TouchScript/releases/tag/9.0) with bolt in my project. to get the pressGesture, I need this script attached to my object:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using TouchScript.Gestures;
using System;
public class pressM05 : MonoBehaviour {
    
    PressGesture pressGesture;
    int bull = 100;
    void OnEnable()
    {
        pressGesture = GetComponent<PressGesture>();
        pressGesture.Pressed += pressedHandler;
    }
    void pressedHandler(object sender, EventArgs e)
    {
        print(bull);
    }
}

I would like to build a node for this one in the flow-machine. I thought, therefor it should look like this: 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using TouchScript.Gestures;
using System;
public class t04 : MonoBehaviour {
    public void ini(){
        PressGesture pressGesture;
        pressGesture = GetComponent<PressGesture>();
        pressGesture.Pressed += presshandler;
    }
    public void presshandler(object sender, EventArgs e){
        print ("ccc");
    }
}

but get the error "missing target object":

InvalidOperationException: Missing target object for 't04.ini'.
Ludiq.Member.EnsureReady () (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Reflection/Member.cs:686)
Ludiq.Member.EnsureInvocable () (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Reflection/Member.cs:770)
Ludiq.Member.Invoke () (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Reflection/Member.cs:803)
Bolt.InvokeMember.Invoke ()
Bolt.InvokeMember.Enter (Bolt.Flow flow)
Bolt.ControlInput.Trigger (Bolt.Flow flow)

what for is the input with the C#-symbol filled with self and how do I get rid of it d do I need it?

as you can see from my unstructured questions, I'm new and really confused. are there any hints, tutorials, documents or other stuff where I can see, how to build custom nodes with C#? or am I blinded and there is a easier solution right around the corner?  thanks in advance.

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Hi, I also need to know how to integrate Touchscript into Bolt. Please can anyone tell us how to use Touchscript gestures? Thank you