Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request. Node Graph Processor editor in runtime #21

Open
JohnathanBurov opened this issue Oct 13, 2022 · 0 comments
Open

Feature request. Node Graph Processor editor in runtime #21

JohnathanBurov opened this issue Oct 13, 2022 · 0 comments

Comments

@JohnathanBurov
Copy link

There si no good documentation for using visualScripting nodes and graph via scripts.
https://docs.unity3d.com/Packages/[email protected]/manual/vs-create-custom-node-add-docs.html
Here is Example but not full for manipulation graph model runtime
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.VisualScripting;

public class TestScriptMachineRuntime : MonoBehaviour
{

// Start is called before the first frame update
void Start(){
    FlowGraph graph = new FlowGraph();
    graph.title = "Ttile1";
    graph.summary = "Summary";


    MachineEventUnit<EmptyEventArgs> u1 = new Start() { position = new Vector2(-204, -144) };
    MachineEventUnit<EmptyEventArgs> u2 = new Update() { position = new Vector2(-204, 60) };
    Literal u3 = new Literal( Type.GetType("System.String"), "test string"){position = new Vector2(-204, 60)};
    
    // Format:  "targetType;name;paramType1;paramType2"
    // Example: "UnityEngine.Transform;rotate;UnityEngine.Vector3"
    Member member = Codebase.DeserializeMember("UnityEngine.Debug;Log;System.Object");
    InvokeMember u4 = new InvokeMember(member);

    graph.units.Add(u1);
    graph.units.Add(u2);
    graph.units.Add(u3);
    graph.units.Add(u4);
}

//I spent 8 + hours for investigation solution and 5+ hours for writing code, because Unity manual is not contains examples
// how to work with visualScripting FlowGraph via C# script. And I did not tested it in build because I still didnot create edge for nodes as you can see in code above. 

}

I found out that 1.8 contains realy immersive changes suitable for best solution
https://docs.unity3d.com/Packages/[email protected]/manual/bolt-interpreter.html?q=Debug

that project is realy new. But It gave me the possibility to draw graph
https://github.com/Sahasrara/GraphViewPlayer

At current moment I am not so confident about code of NGP and how it can be possible
https://docs.unity3d.com/Packages/[email protected] has inbuild graphprocessor execution model
editor visualization for nodes
and only one things to do is writing conection for graphView runtime.

What I need is Runtime implementation of NGP:

  1. UiDocument VisualElement GraphView working runtime
  2. GraphModel
  3. Serialize/deserialize GraphMode <--> GraphView
  4. GraphModel Processor
  5. Controller binding GraphModel <--> graphView

My implementation is raw prototype that can do nothing.
You can try collaborate with that Man [email protected] Developer of https://github.com/Sahasrara/GraphViewPlayer

Screenshot from 2022-10-11 22-19-25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant