playMaker

Author Topic: Help on load level  (Read 1481 times)

timothygao

  • Playmaker Newbie
  • *
  • Posts: 7
Help on load level
« on: May 09, 2019, 11:54:35 PM »
When I first run the start-line scene, the typerwriter and dotween are normal. Once the level (test1) is loaded, than returne start-line scene with load level .
The add script doesn't work anymore. I can't see the typerwriter either. And dotween will show dont destroy onload and it will not work properly.
« Last Edit: May 10, 2019, 12:12:28 AM by timothygao »

timothygao

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Help on load level
« Reply #1 on: May 09, 2019, 11:55:48 PM »
Plase Help

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Help on load level
« Reply #2 on: May 10, 2019, 11:01:06 AM »
I don’t think i understand your problem, can you tell us what you want to achieve ?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Help on load level
« Reply #3 on: May 10, 2019, 06:08:46 PM »
Hi.
Do you get any console errors?

I do not have experience with dotween, so i am not sure why dotween is set to don't destroy.

i do know that there is a 'string typewriter' action on the Ecosystem

Maybe you can use that instead of the script.

timothygao

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Help on load level
« Reply #4 on: May 10, 2019, 06:46:24 PM »
Thank you two brothers reply。I want the text under the bird picture to show the effect of typing. But when I switched in from another scene, the typing effect didn't work.I used a typerwriting script instead playmaker action。

timothygao

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Help on load level
« Reply #5 on: May 10, 2019, 06:57:56 PM »
Code: [Select]
using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class TypewriterEffect : MonoBehaviour {

public float charsPerSecond = 0.26f;
private string words;

private bool isActive = false;
private float timer;
private Text myText;
private int currentPos=0;


void Start () {
timer = 0;
isActive = true;
charsPerSecond = Mathf.Max (0.2f,charsPerSecond);
myText = GetComponent<Text> ();
words = myText.text;
myText.text = "";
}

// Update is called once per frame
void Update () {
OnStartWriter ();
//Debug.Log (isActive);
}

public void StartEffect(){
isActive = true;
}

void OnStartWriter(){

if(isActive){
timer += Time.deltaTime;
if(timer>=charsPerSecond){/
timer = 0;
currentPos++;
myText.text = words.Substring (0,currentPos);

if(currentPos>=words.Length) {
OnFinish();
}
}

}
}

void OnFinish(){
isActive = false;
timer = 0;
currentPos = 0;
myText.text = words;
}




}
I Activate text and add scripts when needed
« Last Edit: May 11, 2019, 08:41:59 AM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Help on load level
« Reply #6 on: May 11, 2019, 11:04:28 AM »
Hi.

When Reloading the script might not be triggered correctly.
Did you make the script?

I updated the script to make it work better AND i also made an action to use with it.

Before importing the attachment below, remove the TypewriterEffect script (or move to a location outside the project)
Else you might get a duplicate error

The action is called TypewriterEffect

You need to place the component manually now (do not use add script action) , but it will not start until you do the action.

You should use ui text set text right before this action.
to set a text that you wish to display.

I have added a sample scene to show you how it works.

The sample scene is called : TypewriterSample

timothygao

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Help on load level
« Reply #7 on: May 12, 2019, 10:16:39 AM »
I am very grateful, I changed the version, used the latest version of playmaker, and then used 2018unity, and then deleted some unused plugins, the result is ok. There may be some conflicts between plugins.