Here. I want to find out a way to resolve my problem. I am learning Visual Scripting. After I successfully implemented the function of instantiating an object at runtime, I wanted to add another Visual Scripting Component immediately to this object, I tried to add a Game Object Add component node after the Game Object Instantiate node. Input a Get Variable Scecen node with the target Visual Scripting to the Game Object Add component node but failed.
Get a notification: > Can’t add component because ‘GameObject’ is not derived from Component.
UnityEngine.GameObject:AddComponent (System.Type)
Unity.VisualScripting.InstanceFunctionInvoker3<UnityEngine.GameObject, System.Type, UnityEngine.Component>:InvokeUnsafe (object,object) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Core/Reflection/Optimization/InstanceFunctionInvoker_1.cs:51) Unity.VisualScripting.InstanceFunctionInvoker
3<UnityEngine.GameObject, System.Type, UnityEngine.Component>:Invoke (object,object) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Core/Reflection/Optimization/InstanceFunctionInvoker_1.cs:32)
Unity.VisualScripting.Member:Invoke (object,object) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Core/Reflection/Member.cs:951)
Unity.VisualScripting.InvokeMember:Invoke (object,Unity.VisualScripting.Flow) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Flow/Framework/Codebase/InvokeMember.cs:312)
Unity.VisualScripting.InvokeMember:Enter (Unity.VisualScripting.Flow) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Flow/Framework/Codebase/InvokeMember.cs:404)
Unity.VisualScripting.Flow:InvokeDelegate (Unity.VisualScripting.ControlInput) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Flow/Flow.cs:451)
Unity.VisualScripting.Flow:Invoke (Unity.VisualScripting.ControlOutput) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Flow/Flow.cs:347)
Unity.VisualScripting.Flow:Invoke (Unity.VisualScripting.ControlOutput) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Flow/Flow.cs:351)
Unity.VisualScripting.Flow:Invoke (Unity.VisualScripting.ControlOutput) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Flow/Flow.cs:351)
Unity.VisualScripting.Flow:Invoke (Unity.VisualScripting.ControlOutput) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Flow/Flow.cs:351)
Unity.VisualScripting.Flow:Run (Unity.VisualScripting.ControlOutput) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Flow/Flow.cs:240)
Unity.VisualScripting.EventUnit1<Unity.VisualScripting.EmptyEventArgs>:Run (Unity.VisualScripting.Flow) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Flow/Framework/Events/EventUnit.cs:182) Unity.VisualScripting.EventUnit
1<Unity.VisualScripting.EmptyEventArgs>:Trigger (Unity.VisualScripting.GraphReference,Unity.VisualScripting.EmptyEventArgs) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Flow/Framework/Events/EventUnit.cs:154)
Unity.VisualScripting.EventUnit1/<>c__DisplayClass14_0<Unity.VisualScripting.EmptyEventArgs>:<StartListening>b__0 (Unity.VisualScripting.EmptyEventArgs) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Flow/Framework/Events/EventUnit.cs:67) Unity.VisualScripting.EventBus:Trigger<Unity.VisualScripting.EmptyEventArgs> (Unity.VisualScripting.EventHook,Unity.VisualScripting.EmptyEventArgs) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Core/Events/EventBus.cs:71) Unity.VisualScripting.EventMachine
2<Unity.VisualScripting.FlowGraph, Unity.VisualScripting.ScriptGraphAsset>:TriggerRegisteredEvent<Unity.VisualScripting.EmptyEventArgs> (Unity.VisualScripting.EventHook,Unity.VisualScripting.EmptyEventArgs) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Core/Events/EventMachine.cs:35)
Unity.VisualScripting.EventMachine2<Unity.VisualScripting.FlowGraph, Unity.VisualScripting.ScriptGraphAsset>:TriggerEvent (string) (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Core/Events/EventMachine.cs:13) Unity.VisualScripting.EventMachine
2<Unity.VisualScripting.FlowGraph, Unity.VisualScripting.ScriptGraphAsset>:Update () (at ./Library/PackageCache/com.unity.visualscripting@1.8.0/Runtime/VisualScripting.Core/Events/EventMachine.cs:74)
My Visual Scripting screenshot:
The target Visual Scripting Component is bonded with an empty object but not activated yet.
I also tried to use Get Component node and other ways, but they are worse. Because they return wrongs. Can anyone help me? Thanks.