I'm currently looking at using the Invoke Method action to fetch some data within a class using Behavior Designer. Only one method in this class (other than presumably builtin ones by Unity) is shown by default, and that method has a void return and no parameters. Based on the following thread:
https://opsive.com/forum/index.php?threads/invoke-method-doesnt-show-some-method.419/
I'm led to believe that I need to create a SharedVariable for the type I'd like to return, so I did that. My class is called Item and I created a class called SharedItem:
After adding this, I still don't see my method in Behavior Designer. Am I supposed to have my method change to return SharedItem instead of Item, or should it work with my method like so:
Either way I haven't found much documentation on this topic, so more explicit documentation on how to hook all this up would be helpful.
Thanks in advance for any assistance!
https://opsive.com/forum/index.php?threads/invoke-method-doesnt-show-some-method.419/
I'm led to believe that I need to create a SharedVariable for the type I'd like to return, so I did that. My class is called Item and I created a class called SharedItem:
C#:
[System.Serializable]
public class SharedItem : SharedVariable<Item>
{
public static implicit operator SharedItem(Item value) { return new SharedItem { Value = value }; }
}
After adding this, I still don't see my method in Behavior Designer. Am I supposed to have my method change to return SharedItem instead of Item, or should it work with my method like so:
public Item GetItem() { ... }
? I would expect I could use Item, because, for example, I can use int instead of SharedInt (which does exist).Either way I haven't found much documentation on this topic, so more explicit documentation on how to hook all this up would be helpful.
Thanks in advance for any assistance!
Last edited: