Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor won't shows functions with parameters #1

Open
carlosgc opened this issue Jan 23, 2014 · 3 comments
Open

Editor won't shows functions with parameters #1

carlosgc opened this issue Jan 23, 2014 · 3 comments

Comments

@carlosgc
Copy link

Hi,

I trying to use Signal with the last version of Unity but the editor is not showing my gameobject function when parameters are added to it. I followed the tutorial found at http://unitypatterns.com/resource/signals and my code is right, apparently. Any idea of whats can be happening?

The editor are showing the gameobject functions with no parameters and they are working fine.

Thanks

using UnityEngine;
using System.Collections;

public class BoardController : MonoBehaviour
{
    void Start ()
    {
    }

    void Update ()
    {
    }

    [Signal]
    void onBoardTouchEnd(TouchHelper touchHelper)
    {
        Debug.Log("BoardController::onBoardTouchEnd");
    }
}
using UnityEngine;
using System.Collections;

public class TouchHelper : MonoBehaviour
{
    public Signal onTouchEnd = new Signal(typeof(TouchHelper));

    private bool dragging = false;

    void OnMouseUp()
    {
        this.dragging = false;
        if(this.onTouchEnd != null)
        {
            this.onTouchEnd.Invoke(this);
        }
    }
}
@UnityPatterns
Copy link
Owner

If the signal previously had a no-parameter signal assigned, and you added
the parameter later, unity still might have the firsts one serialized.

Try this: mark the signal variable as [NonSerialized], return to the
editor, let it refresh (to clear any serialized data) then go back and
delete the [NonSerialized] attribute, see if that fixes the problem.

On Thursday, January 23, 2014, Carlos Correia [email protected]
wrote:

Hi,

I trying to use Signal with the last version of Unity but the editor is
not showing my gameobject function when parameters are added to it. I
followed the tutorial found at http://unitypatterns.com/resource/signalsand my code is right, apparently. Any idea of whats can be happening?

The editor are showing the gameobject functions with no parameters and
they are working fine.

Thanks

using UnityEngine;using System.Collections;
public class BoardController : MonoBehaviour{
void Start ()
{
}

void Update ()
{
}
[Signal]
void onBoardTouchEnd(TouchHelper touchHelper)
{
    Debug.Log("BoardController::onBoardTouchEnd");
}}

using UnityEngine;using System.Collections;
public class TouchHelper : MonoBehaviour{
public Signal onTouchEnd = new Signal(typeof(TouchHelper));

private bool dragging = false;

void OnMouseUp()
{
    this.dragging = false;
    if(this.onTouchEnd != null)
    {
        this.onTouchEnd.Invoke(this);
    }
}}


Reply to this email directly or view it on GitHubhttps://github.com//issues/1
.

@carlosgc
Copy link
Author

On Thu, Jan 23, 2014 at 2:47 PM, UnityPatterns [email protected]:

[NonSerialized]

I didn't use the [NonSerialized] attribute, instead I removed the signal
variable, saved the project, added it back and it worked.

Thank you for the tip.

Carlos H. G. Correia

Caique

Gaudium et Spes [Alegria e Esperança]
Fique na Paz

@UnityPatterns
Copy link
Owner

Ah yes, that would achieve the same effect. Glad you got it! I haven't
thought of a good way to prevent that happening.

On Friday, January 24, 2014, Carlos Correia [email protected]
wrote:

On Thu, Jan 23, 2014 at 2:47 PM, UnityPatterns <[email protected]<javascript:_e({}, 'cvml', '[email protected]');>>wrote:

[NonSerialized]

I didn't use the [NonSerialized] attribute, instead I removed the signal
variable, saved the project, added it back and it worked.

Thank you for the tip.

Carlos H. G. Correia

Caique

Gaudium et Spes [Alegria e Esperança]
Fique na Paz


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-33219141
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants