Skip to content

Editor won't shows functions with parameters #1

Open

Description

@carlosgc

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);
        }
    }
}

Activity

  1. UnityPatterns commented on Jan 23, 2014

    @UnityPatterns
    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 notifications@github.com
    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
    .

  2. carlosgc commented on Jan 24, 2014

    @carlosgc
    Author

    On Thu, Jan 23, 2014 at 2:47 PM, UnityPatterns notifications@github.comwrote:

    [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

  3. UnityPatterns commented on Jan 24, 2014

    @UnityPatterns
    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 notifications@github.com
    wrote:

    On Thu, Jan 23, 2014 at 2:47 PM, UnityPatterns <notifications@github.com<javascript:_e({}, 'cvml', 'notifications@github.com');>>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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions