Custom script on Unity GameObject when use events, is it possible ?

Due to human (non-bot) spam the first contribution of a user has to be reviewed and activated manually, all further contributions do not require this.
As long as a user does not have at least one reviewed and activated contribution, the user is unable to edit his profile, set a avatar, title picture or a signature.
  • I will try to explain clearly what I try to do with a simple example.

    This is an example and not exactly what I want to do I explain later

    I have a cube and a sphere in it and I want to show/hide the sphere using an event.
    Here is the simple object.

    I have done a script


    The script is on the child object (for people think I missed this part). I already tried to put the script on the parent object without success.

    Has you can see on the above screen the event is properly set.
    Here the server object script.

    I just want that when I right click on the cube the sphere show and hide.

    I want to say that I don't need to have a custom script for doing that.
    I can just do this.
    This work fine with the above script.

    If you want to tell me why you don't use the above solution if it's work.
    It's because I can't do everything with that.
    Imagine (don't ask me why) I want to change the color of the material dynamically with constant for the red, blue and green color.
    Here is the new code.

    C#
    public class CustomScriptTest : MonoBehaviour {
    
    
        public void TestFunction(float value)
        {
            gameObject.GetComponent<MeshRenderer> ().material.color = new Color (value, value * 0.5f, value * 0.25f);
        }
    }

    I change the boolean event to float event.

    I change the OnActRight function.

    I know this is stupid to try to do that, but it's just to show that without a custom script I can't do it.

    Thanks everyone for reading my problems and trying to help.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!