Issues with calling a public runtime script method with a button press.
- This topic has 3 replies, 2 voices, and was last updated 3 days, 10 hours ago by .
- You must be logged in to reply to this topic.
Welcome to Portals United! / Forums / Troubleshooting / Issues with calling a public runtime script method with a button press.
Hi, I want to call a method with a simple button press. The idea is to connect the Button Signal to a simple node and call the public method inside the RunAction. Is this possible / intended to work? What is the recommended way to do this?
When I try it I get the error message that my AutoAdaptiveManager (RuntimeScript) doesn’t exist:
Node:
using ExcursionXR.SyncLib;
namespace ExcursionXR.Nodes{
public class PlacementNode : NodeBase { // fully identically to 'MyDebugNode'
...
public void RunAction() { AutoAdaptiveManager.Instance.PlaceAll();}
}
RuntimeScript:
namespace ExcursionXR.SyncLib {
public class AutoAdaptiveManager : DataComponentBase
...
private void Start() { Instance = this; }
public void PlaceAll() {}
}
Unfortunately it seems that runtime scripts doesn’t exist for nodes. Are they compiled separately?
What should I do?
I guess, send me your node code and I’ll check what’s wrong with it. Are you sure that the script which has an Instance variable is added somewhere to a GameObject? Otherwise the class was never instantiated and really doesn’t exist.
The issue start already earlier:
The namespace name 'SyncLib' doesn't exist in the namespace 'ExcursionXR'
That means the node doesn’t now about the other script.
But anyway I found the solution. I was using different script folders and imported them separately. By importing all script in once it works 🙂