playMaker

Author Topic: Triggering UI sprites and suchlike HELP!  (Read 946 times)

George

  • Playmaker Newbie
  • *
  • Posts: 15
Triggering UI sprites and suchlike HELP!
« on: October 12, 2021, 10:31:46 AM »
hello i first must say that i am really stupid and don't know anything much about scripting at all so bought playmaker as it said it avoided scripting. well i have hit a brick wall immediately unfortunately. i am not sure if i am doing things really backwards but unity seems overly complicated for some things. i am making a driving game just to teach about speeding and have the car on a fixed spline track. when i pass through a cube trigger i want it to display a new speed limit sprite on the ui. can i find any possible way to do this ? in a word, no.

as i said before i am stupid but i presumed that UI interaction would be really common and easy to do. am i doing this wrong ? is UI something else in unity and it doesn't represent stuff appearing over the game world like score/warnings etc ? i am incredibly confused now and could really use some help.

What I want to understand how to do:

Put a box in that the vehicle passes through and it will bring up a predetermined sprite on the UI while the player is within that box section. (also is it possible to fade these sprites in and out rather than just having them appear?)

Put a box that checks the vehicles speed and if it is over the limit then a demerit is applied.

Once I can actually understand how to put in triggers that work i am sure i can figure out a lot more on my own but as i said before i am just totally confused now by the whole thing and really need some help ! please bear in mind i have zero idea what i am doing which is why i invested in playmaker :)

George

  • Playmaker Newbie
  • *
  • Posts: 15
Re: Triggering UI sprites and suchlike HELP!
« Reply #1 on: October 12, 2021, 11:31:05 AM »
i just basically want to be able to make a sprite appear onscreen on the canvas once the player passes through the trigger. i must be over complicating things i suppose !

George

  • Playmaker Newbie
  • *
  • Posts: 15
Re: Triggering UI sprites and suchlike HELP!
« Reply #2 on: October 12, 2021, 12:56:07 PM »
okay so i have managed to start the game with the UI element in place and hidden via putting an "activate game object" action on it and setting activate to off.

How then would I get this to display when I cross a trigger ? I'm still not quite getting the workflow of playmaker, it seems, and it's possible i'm referencing objects incorrectly or using the wrong commands. I'd just want the trigger to re-activate the ui object.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Triggering UI sprites and suchlike HELP!
« Reply #3 on: October 12, 2021, 01:13:58 PM »
Hi.
Instead of disabling the object, you can create a "Empty" sprite (just have the sprite with a 0 alpha)

You can use UI Image Set Sprite to change the sprite.
On 'Game Object' make sure its targeting the correct gameobject that you want to change the sprite on.

George

  • Playmaker Newbie
  • *
  • Posts: 15
Re: Triggering UI sprites and suchlike HELP!
« Reply #4 on: October 12, 2021, 03:47:49 PM »
that is a good idea mate i thought something like that might also work as then the sprite reference can be changed and it's easier. however how would i instigate this behaviour ? as i said mate sorry i am not the sharpest knife in the drawer, do i begin with a collider or trigger ? my train travels through the cube that causes the image to appear, so which would be the trigger ? sorry for the stupid questions i suppose everyone starts somewhere and i did google a lot for this but couldn't find anything that relates 100% to what i want to do in terms of explaining it (there was a good video but it was from 2014 and everything seems different now)

George

  • Playmaker Newbie
  • *
  • Posts: 15
Re: Triggering UI sprites and suchlike HELP!
« Reply #5 on: October 12, 2021, 04:46:22 PM »
okay well now i have gotten someplace thanks to your advice and to more digging into triggers. i was definitely over complicating things. this actually seems far easier than i was making it, at least so far. i did not really understand how playmaker was/is working so i am getting more used to that it is quite interesting but at least i have a part of my base functionality involved now ! :-) i will be back with more stupid questions i am sure thanks a lot for the help so far !

10high

  • Playmaker Newbie
  • *
  • Posts: 33
    • Cult Manager - Google Play
Re: Triggering UI sprites and suchlike HELP!
« Reply #6 on: October 13, 2021, 05:43:34 AM »
Don't be disheartened. There is a STEEP learning curve. In my experience, it's not so much about learning how Playmaker works, but how Unity works.

I also found a lot of things to be "counter-intuitive", but as you learn more pieces of the puzzle, you'll start to see how they fit together. The Unity UI system, in particular, can be quite impenetrable. Lots and lots of YouTube tutorials is definitely the way to go.

Good luck.
Cult Manager


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Triggering UI sprites and suchlike HELP!
« Reply #7 on: October 13, 2021, 07:13:47 AM »
Hi.
this video explains a bit on how to send events to other objects :


As you can 'animate' the sprite to do things like fade in for example
And by using a Fsm dedicated to do that, you don't need to do the whole process on each trigger but rather let the trigger do a send event and let the 'UI' fsm handle the rest. (for example, fade in, wait x seconds and fade out)

You should also join Discord if you can, it has over 1.200 member now and are 'Beginner' friendly :) (also for not beginners ;) )

George

  • Playmaker Newbie
  • *
  • Posts: 15
Re: Triggering UI sprites and suchlike HELP!
« Reply #8 on: October 15, 2021, 06:49:34 AM »
hello mate yes i did try to join the discord but it did not seem to work it said invalid link so i will try again later today !