Pass a parameter or have a return function to unity

Thu 9. Mar 2017, 16:13

Hi,

Based on the Mantic Manfred Demo project for Articy 3, it's use the function "Restart()", wich it's map automaticly with the method in SceneHandler.
I would like to do pass some parameters or have a return. So I try : Inventory.test = restart(Inventory.test). No error in Articy
When I export, in Articy Script Fragment, I got the good method with return type and parameters in the #region Script fragments. But in the #region Script methods implementation , I don't have a method with parameters and return type.

So I have miss anything wich permit to do that?

I think I can ByPass That By Make some globalVariable Parameters and return for each function call like that, but it's feel dirty


Thank you

Code: Select all
        public void Script_oRt7JsX7YkCaGGRA70XtOA(ArticyGlobalVariables aGlobalVariablesState, Articy.Unity.IBaseScriptMethodProvider aMethodProvider)
        {
            aGlobalVariablesState.Inventory.test = restart(aMethodProvider, aGlobalVariablesState.Inventory.test);
        }



Code: Select all
        #region Script methods implementation
        private void restart(Articy.Unity.IBaseScriptMethodProvider aMethodProvider)
        {
            if ((aMethodProvider != null))
            {
                ((IScriptMethodProvider)(aMethodProvider)).restart();
            }
        }
        #endregion
User avatar
Zeldarck
 
Posts: 55
Joined: Thu 9. Mar 2017, 16:03

Re: Pass a parameter or have a return function to unity

Thu 9. Mar 2017, 16:36

Hi Zeldarck,

Thats indeed a bit odd. It could be because of the reused method "restart". Could you please try again with a new method, just use a new method name in articy:draft in your scripts and it should export automatically, also automatically updating the IScriptMethodProvider interface.
At the moment i suspect a hiccup in the code generation, can you try to clear the generated files and import again? Via the menu "Articy -> Advanced -> Clear generated files" and then just "Articy -> Import articy:draft export file"

But to be clear, yes what you have tried is perfectly fine and should work. It just seems that the plugin didn't properly generated the necessary code.

Let me know how it turns out.

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: Pass a parameter or have a return function to unity

Fri 10. Mar 2017, 08:52

Hi,

Thank for the fast answer, I try with clear and reimport, same problem. I also try to use an other method name instead of restart and same :/
It update the interface, but put :

Code: Select all
namespace Articy.ManiacManfred
{
   
   
    public interface IScriptMethodProvider : IBaseScriptMethodProvider
    {
       
        void test();
       
        void restart();
    }
}


I Got Unity 5.6.0b9, I got the last version of the articy importer available and Articy:darft3 Multi-user V3.0.3

I have try with an other project, it's do the same
User avatar
Zeldarck
 
Posts: 55
Joined: Thu 9. Mar 2017, 16:03

Re: Pass a parameter or have a return function to unity

Fri 10. Mar 2017, 13:06

Ok a first update,

i can confirm that there is currently a bug with methods and parameters, unfortunately it is inside articy:draft which means it will take a bit longer to release a fix.
From the looks of it, hardcoded values should work in methods like

Code: Select all
restart(5);


but ofc is limited.
I also forgot that we limited return types to void and bool. But when i'm already working on it, i see what i can do to soften that constraint a bit, to at least allow our global variable types.

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: Pass a parameter or have a return function to unity

Fri 10. Mar 2017, 14:08

Ok, Thank you :)

Have you an estimation of duration of the "bit longer"? I would like to know if I can build my archiecture with that functionnality. (for the variables in parameters)

With a fix parameter it's seem ok :)

Hum, I test with all kind of variable, and nothing works :/
User avatar
Zeldarck
 
Posts: 55
Joined: Thu 9. Mar 2017, 16:03

Re: Pass a parameter or have a return function to unity

Fri 10. Mar 2017, 14:50

Have you an estimation of duration of the "bit longer"?


Afraid not, but i would not expect it this month. We have a couple of issues we want to fix and we usually bundle them in a single bigger update.

And yes, no global variables are working as a parameter at this time, until i have fixed it.

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: Pass a parameter or have a return function to unity

Fri 10. Mar 2017, 15:00

Ok I understand :)


The "Hum, I test with all kind of variable, and nothing works :/" part of my answer was for the return type, sorry if it was unclear. This is more problematic if I cannot have at least boolean in return type
User avatar
Zeldarck
 
Posts: 55
Joined: Thu 9. Mar 2017, 16:03

Re: Pass a parameter or have a return function to unity

Mon 13. Mar 2017, 08:58

Hum, so for the return type, you confirm it's a bug if only void it's allow for me? Do you know if it will be correct soon?

Thank you :)
User avatar
Zeldarck
 
Posts: 55
Joined: Thu 9. Mar 2017, 16:03

Re: Pass a parameter or have a return function to unity

Mon 13. Mar 2017, 10:05

Both parts are broken; Return type and Parameters. I'm in the middle of fixing it, but again, i can't give you an estimate when we release this fix.

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: Pass a parameter or have a return function to unity

Mon 13. Mar 2017, 10:12

Ok, Thank you, I will do that by pass in parameter the variable where stock the return :)

Good luck
User avatar
Zeldarck
 
Posts: 55
Joined: Thu 9. Mar 2017, 16:03

Return to Technical Discussion

Who is online

Users browsing this forum: No registered users and 12 guests

Who We Are
Contact Us
Social Links