playMaker

Author Topic: Always in back image Background  (Read 871 times)

Darnen

  • Playmaker Newbie
  • *
  • Posts: 13
    • View Profile
Always in back image Background
« on: January 18, 2016, 05:49:36 PM »
Hey guys, so I am making a little text based game and I have multiple FSM attached to game objects and each gameobject acts as its own scene. Now what its suppose to do is once the player finishes one scene (GameObject) it switches to another one and back and forth depending on where the player is going and everytime a new scene is changed it is suppose to change the background accordingly. For example if the player enters a city it shows the city background if the player enters the forest it shows the forest background so on and so forth. The way I have this setup is in the Camera FSM I have each background image on its on state using Draw Texture action, with a global event that is called by the scene GO's. and so far that works the way its suppose to but the problem I am having is the background images are not staying in the background, they are overlaying on top of all my other images and assets such as text.. So the question I am asking is is there a way to force the draw texture action to show the bg images behind all the other images and assets, like a send to back sort of function?

I attempted to have the background image loaded on each gameobject but it only worked when I had draw texture action on each and every State in the FSM, which would be very tedious and intensive.

Or maybe someone has some ideas on a better way to do this?

Thanks in advance!

Stinkhorse

  • Playmaker Newbie
  • *
  • Posts: 20
    • View Profile
Re: Always in back image Background
« Reply #1 on: January 18, 2016, 09:47:17 PM »
I'm looking to learn an answer to this as well Darnen. The best example I've seen so far was produced for a infinite scroller where the far background always had to be a static image that filled the background of the camera no matter where or how the camera panned/zoomed. The way I remember it being described was having a second camera that would sit stock still and look at a background image somewhere far away from the game objects. Its view was then projected to the main camera, with a whole bunch of draw priority check boxes marked or unmarked in both cameras. Now the last time I tried it I was a day and a half into using Unity and none of it worked, but then I was trying to script it by hand, and hadn't picked up playmaker yet.

Right now in my own project I have a stop gap measure of an image parented to the main orthographic camera and shifted to the far end of it's viewing box. It pans with the camera and gives me the look that I want, but still zooms when I dolly the ortho view in or out. Still, for your purposes it might work (I'm very new at this still and I might be throwing out a VERY beginner crap solution you've already tried). 

Darnen

  • Playmaker Newbie
  • *
  • Posts: 13
    • View Profile
Re: Always in back image Background
« Reply #2 on: January 21, 2016, 06:49:04 AM »
Thanks for the advice, I haven't tried that particular solution but that does give me an idea. Basically I could setup a BG Gameobject (A plane or a box I think) and just set to be static and when I need a different background just draw a new material onto that Gameobject. It might take a little to setup initially but I think that might be my quickest solution.