dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: NEED HELP DECYPHERING INSTRUCTIONS and general coding help!

  1. #1
    Join Date
    Feb 2014
    Posts
    2

    Question NEED HELP DECYPHERING INSTRUCTIONS and general coding help!

    i bought an asset because it was not free and i am not very familiar with creating JavaScript codes. the asset is supposed to help me create transitions between scenes in unity using javascript codes, but i am somehow supposed to tweak the codes to get the effects to work properly. i tried to contact support but to no avail:

    read me file:

    Easy Masking Transition - Version 0.9
    Copyright 2013- Ages three and app
    email: info@agesthreeandapp.com

    ----------------------------------------------
    How to use it:
    ----------------------------------------------

    1. drag and drop the "Presets/EMTransition - Color" or "Presets/EMTransition - Image" to your scene.
    2. edit in inspector window.
    3. add JS/C# script and write "OnTransitionComplete()" to launch at the end of the transition.

    ----------------------------------------------
    API
    ----------------------------------------------

    function OnTransitionStart() : void
    launch at the beginning of the transition
    (When Preview Mode is true, it doesn't call)

    function OnTransitionComplete() : void
    launch at the end of the transition
    (When Preview Mode is true, it doesn't call)

    function EMTransition.play() : void
    if playOnAwake is false, you need to call play() to start transition.

    ----------------------------------------------
    Tips
    ----------------------------------------------

    If you would like to use multiple transitions, you should duplicate materials.


    apparently there are loads of ways to code transitions, i found an easy and legit one that worked for me for free, but it only works on the first scene and only for the beginning, so i don't know how to tweak it for an effect at the beginning and the end of a scene. and, if i add the code to 2 scenes it only shows up on the first one.

    var theTexture : Texture2D;

    private var StartTime : float;

    function OnGUI(){

    // set the color of the GUI

    GUI.color = Color.white;

    // interpolate the alpha of the GUI from 1(fully visible)

    // to 0(invisible) over time

    GUI.color.a = Mathf.Lerp(2.0, 0.0, (Time.time));

    // draw the texture to fill the screen

    GUI.DrawTexture(Rect(0,0,Screen.width, Screen.height), theTexture);


    is there an easier way to code at least just a fade in/out in javascript? lil help?

  2. #2
    Join Date
    Jan 2014
    Posts
    28
    function OnGUI is what is making it only work on the first scene. I assume as soon as Unity starts the OnGUI function is being called, It's not being called for every scene. So to make it work with every scene you would have to find out what function is being called at the beginning of every scene and change the name to that.

    Same goes for the end of a scene, You would have to find out what function is being called at the end of a scene and duplicate that code and change the function name. "function onSceneStart() {" , "function onSceneEnd() {" Odds are these do not work, Just an example of what you need to change / look for.

  3. #3
    Join Date
    Feb 2014
    Posts
    2
    i think i kinda understand what you mean. but would the fact that i added the same script to the camera in both scenes mean anything? shouldn't it call for the function onGUI at the beginning of each scene? so if it doesn't, i would have to remove the script, and add script from the asset...... i have been playing with the asset and found that it is working, however i don't know how to find and adjust the times of the transitions from the code. what is "time" and "delta" and all that? .. also the function onGUI script worked in the scene, however when linked to another scene it doesn't work. say i have a scene. i play the scene and it fades in. i have another scene. i play the scene, it fades in, and it goes to the first screen without fading in/out. but i want it to.

    is there an easier way to code at least just a fade in/out in javascript? lil help?

    i about to break down and buy another asset .. scene manager, or something...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles