Serializable Method Calls

FREE
Publisher Preoccupied Games
File size 21.41kB
Number of files 14
Latest version 1
Latest release date 2015-02-19 02:28:03
First release date 2015-02-19 02:28:03
Supported Unity versions 2018.4.2 or higher
This package allows you to store method calls and edit them in the Unity Editor.

All you need to do is add a MethodCall field, attach the MethodCallEditorAttribute onto it, and call Invoke on it somewhere. The editor does the rest.

How is this different than UnityEvents? Well, there are a few things:
- These will return the result of a call.
- This can fit any set of arguments (of a subset of basic types, but this can be extended to handle other types.)
- This package allows you to resolve the target of a method call to something other than a Component or GameObject, or to use custom code to call a method on something that is created at runtime.

If you need to add special logic for resolving the target object, you can extend MethodCallTarget. When invoking the object, you can pass in some context about how its being invoked, and use this context in your specialized MethodCallTarget's ResolveTarget method.

Other features that could be implemented later, if there is enough interest in this:
- a parameter resolver, similar to the target resolver above.
- a nicer interface.

Top Publisher Assets