Hello Guest

Author Topic: Chance camera background color  (Read 4891 times)

DemiGoth

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Chance camera background color
« on: February 13, 2014, 08:08:46 am »
I'm trying to figure out how to change the camera background color. As far as I can see, there's only an to GET the background settings and not SET it. Is this correct? If not, how can I SET the camera background color?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Chance camera background color
« Reply #1 on: February 13, 2014, 10:05:52 am »
just set camera.backgroundColor?

DemiGoth

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Chance camera background color
« Reply #2 on: February 15, 2014, 05:25:57 pm »
Tried that one already and I get "Assets/Scripts/MainGame.cs(168,40): error CS1955: The member `UnityEngine.Camera.backgroundColor' cannot be used as method or delegate" when I use camera.backgroundColor(Color.blue).

When I use myCamera.backgroundColor(Color.blue) (derived from tk2dCamera) I get "Assets/Scripts/MainGame.cs(168,42): error CS1061: Type `tk2dCamera' does not contain a definition for `backgroundColor' and no extension method `backgroundColor' of type `tk2dCamera' could be found (are you missing a using directive or an assembly reference?)".

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Chance camera background color
« Reply #3 on: February 15, 2014, 06:02:17 pm »
Why on earth are you calling it as a method? You just need to assign the value,
camera.backgroundColor = Color.blue;

DemiGoth

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Chance camera background color
« Reply #4 on: February 16, 2014, 07:20:50 am »
camera.backgroundColor = Color.blue; Works, but only on the normal camera. The tk2dCamera doesn't allow this to be used. Did you remove the tk2dCamera on your latest release?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Chance camera background color
« Reply #5 on: February 16, 2014, 11:02:42 am »
backgroundCOlor is a property on the camera, not the tk2dCamera, so z.camera.backgroundColor will work

DemiGoth

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Chance camera background color
« Reply #6 on: February 16, 2014, 01:02:46 pm »
Okay, that's clear. But how do I change the background color of the tk2dCamera that I'm using? In your tutorials you state clearly that you need to remove the default (3D) camera and use the tk2dCamera instead. And with that one not having a backgroundColor property I'm wondering how to set it.

I did use camera.BackgroundColor=Color.blue, and the camera (when I added it) did change to blue, but as said above, it's not showing up on the tk2dCamera.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Chance camera background color
« Reply #7 on: February 16, 2014, 01:59:03 pm »
Get a reference to your camera by dragging and dropping then do mytk2dCameraVar.camera.backgroundColor. Pretty much the usual stuff you'd do in Unity.

DemiGoth

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Chance camera background color
« Reply #8 on: February 16, 2014, 03:03:17 pm »
Just shoot me... Tried this before and it was not working and now it is ...or I must have made a typo somewhere :-\  ANyway, it's working now and BIG THANKS for the help AND patience  :-*