playMaker

Author Topic: How to create a resolution independent background texture?  (Read 2397 times)

polygon

  • Playmaker Newbie
  • *
  • Posts: 18
How to create a resolution independent background texture?
« on: September 08, 2014, 05:44:50 PM »
Hey playmakers,

first of all I want to say that I'm more than impressed by the power of playmaker and it's absolutely worth every penny! :)

But I could need some support with an issue related to resolution independent background images. I tried an approach without any code and it works well:http://answers.unity3d.com/questions/606271/gui-texture-as-background-is-hiding-other-objects.html

As mentioned before, this works pretty well but there's a huge problem: I need to animate the background's offset in certain situations to create the illusion of a moving camera (y-axis) and this doesn't work with gui textures :(

Now I need some advice how to setup a background that

a) works resolution independent and fits every screen size

and

b) offers the possibility to animate the texture offset at any time

I hope you can help me :)

Best regards,
Daniel

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: How to create a resolution independent background texture?
« Reply #1 on: September 08, 2014, 06:20:40 PM »
Use the 'Get Screen Height' and 'Get Screen Width' so you know both of those dimensions, then just use Set Property to set your background accordingly.

For scrolling, I guess you'd want to your texture to be set to wrap in the import settings.

I'd probably use HOTween to tween the values you want to use for animating, and use Set Property every frame to control the offset vaue.

polygon

  • Playmaker Newbie
  • *
  • Posts: 18
Re: How to create a resolution independent background texture?
« Reply #2 on: September 10, 2014, 08:07:29 AM »
Thank you very much! I will try that out :)

polygon