Forum rules - please read before posting.

Tint map and sorting layer random...

Hi,

If I start a scene, my player is affected by the tint map correctly, but when playing the game, the tint map sometimes stays from the scene before, and seems to ADD to the previous tint map and therefore darkens my player too much. This hangover from previous scenes can also affect my sorting layer of my player, where he can sometimes be smaller than he should be, as if he has carried through the previous sorting layer rather than the sorting layer of the scene?

Any reason this is happening or an easy remedy to stop this happening?

Thanks
«1

Comments

  • Likely a bug.  Leave it with me, and I will update if I need any more info.
  • Can't recreate.  Dealing with just the tint map for now, is it placed on the sprite child?  It should not be on the root gameobject.
  • My tint map scripts are placed on the sprite children, i have a root game object, and then within that , a child, that contains head, body, etc with a tint map on each child

    Maybe I should PM you the main character sprite, as I have had issued with tint maps and sorting layers and pivot positions (and discussed in an other thread)
  • I've noticed that when switching player between scenes, my new player does not start to the correct sorting map, but is smaller. If i start the scene from scratch, my new player is the correct size. 

    Is this something to do with player switch or just a bug or something that I have not set up correctly?

    Or is there an action list in scene change that I have in there somewhere that would disable or not notify the player to adhere to the relevant scenes sorting map?
  • Ps The first player in the first scene (Start Screen) of the game is not the default, and then when told to switch to the default player, in the second scene (Control Room) the player is smaller.

    Plus, the tint map issue only seems to happen coming back from a certain scene (Dock - the issue being that my player is constantly dark, as if constantly in shadow) the scene in question is far larger than other scenes . And then when going back to the Control Room, the player is in shadow for the rest of the game, regardless of the tint map.

    Any ideas why this would be happening?

    Thanks
  • Might it be something to so with the save scripts that the program chooses for you?
  • The only save scripts on the prefab you've sent me are two ConstantID components.  There should only be one.  Beyond that, please give me time to examine the issue.
  • Sure, thanks Chris
  • edited April 2016
    The prefab you've sent seems to work fine, but your post since talks about having multiple prefabs, which is an important detail.  Please try to be as clear as possible with regards to this.  Providing clear steps to recreate the issue will help immensely.

    The only way I can see TintMaps being compounded is if a) you have a hierarchy of FollowTintMaps causing a sprite to be affected by more than one at a time, or b) you are changing tint-maps mid-scene.  Does your TintMap have a Constant ID number on it?
  • Hi, so my tint maps don't have a Constant ID on them, I assume I should put one on each?

    Plus, I have a Follow Tint Map (with Affect Children ticked) on the Head GameObject (it has many children), Body GameObject (it has many children), WALK_D GameObject (it has many children), WALK_U GameObject (it has many children). Should I just have the Follow Tint Map on the Garland Root that contains the above objects? 

    See screenshot:

    https://www.dropbox.com/s/2l7pvml2h0eesdf/Screen Shot 2016-04-26 at 17.11.04.png?dl=0

    In regards to multiple prefabs, I think i meant they have multiple animations, the prefab you have is the correct one that appears in the game.

    Cheers
  • No, don't add them.  That adds complexity - I was only asking in case you did.

    Have you tried just having a FollowTintMap on just the sprite object?  I can't say if you should, but it's worth a try of course.

    You wrote of switching players across scenes - this is what I'm referring to about the prefabs.  Please detail exactly how you're managing players across your game scenes.
  • Hi, please see screenshots for managing players across scenes:


    In the opening scene i instantly switch player 2 and then at the end of the scene, I switch to default player.

    Will try just having a FollowTintMap on the sprite object and get back to you with results.

    Thanks
  • Hi, tried FollowTintMap just on SpriteObject with affect children ticked and now tint map does not affect player at all in any scene...
  • edited April 2016
    Regarding tinting not working with just one FollowTintMap: I believe it is because your animations are controlling the colour field of your Sprite Renderers.  Replacing your Walk_U and Idle_U with a blank animation (not just emptying the field, mind) cause the tinting to work.  Try to confirm this yourself: in which case, you'll have to remove the offending property(s) from the animation clips.

    This'll likely be the cause of the main issue, too.  However, scanning over your animations doesn't reveal a change in the colour properties.  It could be that this is actually an issue with Unity itself, though the problem doesn't occur with the 2D Demo player character.
  • Ok thanks, so just to be clear, i need to remove any Sprite Renderer.Color from my animations to avoid this issue? Some of my animations do have a .Color component so maybe that is affecting the overall tint map?

    I will remove these and test. I have one animation where an explosion causes the players face to be covered with ash, and I change the .Color of the face sprite. If I animate this a different way and remove the .Color component this might sort my issue?

    Thanks
  • The tint map works by controlling the colour field - so if you're also animating it then a conflict is going to cause problems.  Whether this sorts the issue or not (hopefully it does), it definitely needs to be done.
  • Hi,I have removed these and there still seems to be an issue, would i need to remove animations controlling the sprite renderer too or are these ok?
  • I'd just be guessing at this point, it's Unity's tool.  You'd need animations to control the sprite renderer's sprite, what else are you animating?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.