playMaker

Author Topic: Difference between LOAD SCENE and LOAD LEVEL?  (Read 3377 times)

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Difference between LOAD SCENE and LOAD LEVEL?
« on: April 19, 2020, 10:06:52 AM »
As per title!  :o

Also, I have variable SCORE that is global and should retain its value when I load a new level, but it gets reset to the default value. How do I do it?
« Last Edit: April 19, 2020, 10:12:24 AM by megmaltese »

rechronicle

  • Full Member
  • ***
  • Posts: 119
  • Mystvaldia
    • Indie RPG Creator
Re: Difference between LOAD SCENE and LOAD LEVEL?
« Reply #1 on: April 19, 2020, 11:09:45 PM »
https://forum.unity.com/threads/application-loadlevel-lvl-obsolet.464157/
"By the way, Application.LoadLevel is obsolete but it still works. Unity will recommend using the new SceneManagement, but Application.LoadLevel can still be used."

We can see here that LoadLevel is obsolete, but we can still use it, although Unity will recommend using LoadScene.

.

To retain variable value over scenes, you can use global variable / singleton manager / playerperf. Look that up, there may be more topic related to them, especially how to use them.

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Difference between LOAD SCENE and LOAD LEVEL?
« Reply #2 on: April 20, 2020, 03:30:50 AM »
Hi, thank you very much for the help.

The variable is set to global. I'll have to check again what's wrong.

Double checked (or triple maybe): "Score" is global and I am using the global variable. Can't really catch what's going on here.

Found: the variable used was correct, but I wasn't setting the UI text at the beginning of the level with the score, so it always showed zero  ;D

However I must say that while LOAD LEVEL works, LOAD SCENE doesn't seem to be working at all, it doesn't load.
« Last Edit: April 20, 2020, 03:54:12 AM by megmaltese »

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Difference between LOAD SCENE and LOAD LEVEL?
« Reply #3 on: April 20, 2020, 01:49:26 PM »
There IS actually a problem in the action LOAD SCENE.
In some conditions, it doesn't work.
I don't know when exactly, but I have one case where it's working and one case in which it is definitely not working.

As you can see in the snapshot, I have put both of them in the same state, to test them.
LOAD LEVEL is working.
LOAD SCENE is not.
Tried with all configurations, etc.
It's a very simple scheme.

In the screenshot they are both active because why not, anyway only one works.

Second attachment shows instance where it is working.
« Last Edit: April 20, 2020, 01:57:22 PM by megmaltese »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Difference between LOAD SCENE and LOAD LEVEL?
« Reply #4 on: April 21, 2020, 09:08:53 AM »
HI.
On the image i can see that you have 2 of the same globals 'New Game'
This will conflict

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: Difference between LOAD SCENE and LOAD LEVEL?
« Reply #5 on: April 21, 2020, 10:01:17 AM »
But THAT'S where it's actually working! Despite the little bug that I introduced.
The problem is in the other FSM, where you can see I'm using both actions.

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Difference between LOAD SCENE and LOAD LEVEL?
« Reply #6 on: April 28, 2020, 07:22:42 AM »
HI.
On the image i can see that you have 2 of the same globals 'New Game'
This will conflict

Thinking of it, there should be a default option by Playmaker where it automatically destroys the old instance of a Global event in case of a conflict. This could be disabled in the Preferences for the sake of testing (something?).

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Difference between LOAD SCENE and LOAD LEVEL?
« Reply #7 on: April 28, 2020, 07:37:29 AM »
Hi.
Destroying i don't think thats a good option.
A warning like when you use the same state name will be better.

for example if you accidentally select the wrong event it would destroy the old one, then you need to place back the old one And change the new one

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Difference between LOAD SCENE and LOAD LEVEL?
« Reply #8 on: April 28, 2020, 11:11:09 AM »
Hi.
Destroying i don't think thats a good option.
A warning like when you use the same state name will be better.

for example if you accidentally select the wrong event it would destroy the old one, then you need to place back the old one And change the new one

Yes, there is a risk of that. But:
- It still goes faster to be able to swap the places for the same GE between two states instead.
- I have rarely faced the case where you add the same GE on the wrong state.
- CTRL Z works.
- A confirmation prompt could work (could be disabled in prefs too to go faster).
- Perhaps a little flash or visual clue where there once was a GE could be present for two seconds, fading and all that.
- CTRL Z really does work.

Overall it's a real issue with the tool because duplicate GEs within a FSM should not be allowed at all.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Difference between LOAD SCENE and LOAD LEVEL?
« Reply #9 on: April 28, 2020, 01:46:35 PM »
Hi.
Maybe easiest way is to color the GE's Red when duplicate exists. and also give error

Flashing previous will not work well as it can be 'off screen'
and removing the old one is not a good option (at least as default)

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Difference between LOAD SCENE and LOAD LEVEL?
« Reply #10 on: April 28, 2020, 06:04:06 PM »
If you can see the red flash you can see any visual clue.
An FSM that is larger than the Graph View might prevent the clue from being useful.
The prompt appears to be a better solution. But I also know I'd deactivate it because I actually found myself moving a GE from one state to another multiple times during dev so I can see how it's faster to auto-delete the old GE, essentially swapping one state for another. I'd be pissed off to say "yes" everytime I'd be asked if I want to remove the GE from state x since every time this case happened to me, I knew where the GE was and I just wanted to move it to another state. In other words, it was not an error but a decision.
I can understand how it might be risky for the people who lost track of where the old GE was.
A simple warning in the console log could be good too. It would tell which state actually had the GE. I would make that an option to be toggled too, it might annoying to have a warning for something we would consider actually normal.
A better option, perhaps, would be to exploit the barely used popup that Playmaker has to tell users that a FSM cannot be edited. It's a little reminder that quickly appears in the Graph View and then fades away. It could tell you the same thing as the warning without clogging the console: "GE [name of event] deleted on [state name]".
All in all I think it would be a nice option.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Difference between LOAD SCENE and LOAD LEVEL?
« Reply #11 on: April 29, 2020, 06:14:50 AM »
Hi.
i Mean Both will be colored Red or have a exclamation mark permanent if 2 exists, not just flash it.

i understand that in your case you would want to set it like that, but especially for newer users it might break their behavior of the fsm without knowing it.

so optional would be good for experienced users.

A pop up could work also and with the same optional to disable popup and auto change.

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Difference between LOAD SCENE and LOAD LEVEL?
« Reply #12 on: April 29, 2020, 09:25:21 AM »
Yes, I don't consider myself that good but there's likely a need for "power" users too.