Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[RELEASED] Pro Camera 2D - The definitive 2D & 2.5D Unity camera plugin

Discussion in 'Assets and Asset Store' started by luispedrofonseca, Jul 29, 2015.

  1. Fjonan

    Fjonan

    Joined:
    Jun 16, 2013
    Posts:
    5
    Hi! I recently bought your script and I am very happy how easy it is to use. Unfortunately the transitions do not work with the "Lightweight Renderpipeline" in use - the transition layer simple does not show up. I created a custom ForwardRenderer (as I have documented here: https://answers.unity.com/questions...eight.html?childToView=1660770#answer-1660770) and this might be interfering but I am very new to this so maybe you know what the problem is right away and it is simply a setting?

    Thanks for your time!
     
  2. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    Hi @Fjonan,

    Unfortunately the new SRP's are still very early and their API is a moving target. Stuff like camera stacking and other features are not present yet so it makes the TransitionsFX and Parallax extensions unsupported for the time being under those pipelines.

    I do plan to update once things settle down, but not before. Until then my recommendation is to stick to the default renderer or find another alternative for the transitions.
     
  3. Fjonan

    Fjonan

    Joined:
    Jun 16, 2013
    Posts:
    5
    Thanks for the quick response! I wanted to switch die LWRP because I love the shader graph tool which is why I won't switch back. I can live without the transitions for now (or even create something with the other camera things) and wait for your update. :)
     
    luispedrofonseca likes this.
  4. Razputin

    Razputin

    Joined:
    Mar 31, 2013
    Posts:
    219
    My games multiplayer so the camera spawns in on start, I'm having trouble setting the rooms.

    Code (CSharp):
    1. public Room[] rooms;
    2.  
    3.         for (int i = 0; i < rooms.Length; i++)
    4.         {
    5.             camera.GetComponent<ProCamera2DRooms>().AddRoom(rooms[i]);
    6.         }
    7.  
    8.  
    Error :

    NotImplementedException: The method or operation is not implemented.
    SpawnManager.Spawn () (at Assets/Scripts/SpawnManager.cs:46)
    SpawnManager.Start () (at Assets/Scripts/SpawnManager.cs:34)

    Is there a different way to set them?
     
  5. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    Hey @Razputin, sorry for the late reply.

    That method (AddRoom) does not take a "Room" instance, but instead takes the parameters that define it:
    Code (csharp):
    1.  
    2. public void AddRoom(
    3.    float roomX,
    4.    float roomY,
    5.    float roomWidth,
    6.    float roomHeight,
    7.    float transitionDuration = 1f,
    8.    EaseType transitionEaseType = EaseType.EaseInOut,
    9.    bool scaleToFit = false,
    10.    bool zoom = false,
    11.    float zoomScale = 1.5f,
    12.    string id = "")
    13. {
    14.  
    The Rooms list, however, is public so you can access it directly as you wish.

    Let me know if this helps. Cheers
     
    Razputin likes this.
  6. Zyblade

    Zyblade

    Joined:
    Jul 1, 2014
    Posts:
    125
    Does this asset support multiple camera while maintain pixelperfection? I couldn't solve this one using unitys pixel perfect camera script.The 2nd cam would be always black, due to the upscale.
     
  7. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    @Zyblade It should work since the pixel-perfect size is calculated according to the viewport size. Feel free to try it and if it doesn't work let me know and I'll see what I can do.
     
    wagenheimer likes this.
  8. Stilghar

    Stilghar

    Joined:
    Feb 4, 2013
    Posts:
    82
    Hi Luis,

    Your camera is great! We're trying to use it in combination with the pixel perfect unity extension (last version) and Unity 2019.3.3f using URP and we have some issues:

    - The extensions that deal with bounds (numeric bounds and rooms) do not work well with the pixel perfect unity extension. We see the pixel perfect camera viewport inside the room bounds for example but then the camera is not able to move. Our guess is that the procamera2d bounds are not using the viewport size before the pixel perfect extension?

    - We are totally unable to launch Transition FX. Any ideas here?

    Thank you!

    David
     
  9. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    Hi @Stilghar,

    I haven't experimented Unity's own pixel perfect solution, so I can't say for sure if it works or not.

    As for TransitionFX, it's currently not supported when using the new SRP's. I'm planning to add support at a later stage once Unity stabilizes their implementation.
     
  10. Stilghar

    Stilghar

    Joined:
    Feb 4, 2013
    Posts:
    82
    Thanks Luis, are you planning to include support for Unity's pixel perfect solution? Many of us are moving to it as it is becoming their standard for pixel perfect.
     
  11. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    @Stilghar Yes, I think it even makes sense to deprecate my own solution in favour of Unity's. No timeline for it though, but keep an eye open for it.
     
  12. Stilghar

    Stilghar

    Joined:
    Feb 4, 2013
    Posts:
    82
    luispedrofonseca likes this.
  13. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    345
    @luispedrofonseca

    example.png

    Is there a way to have an added camera target have a "volume" to it's target point rather than a single point? I'm implementing my own Zoom to Fit extension and am finding that my player targets are getting cropped directly on the point of the player target, and I'd like it instead to have some buffer on the edges of the screen to my player targets.

    Using the offset on the camera target is half of what I'm looking for, but that only offsets on one side of the player, not both. What suggestion do you have for me?

    Thanks
     
  14. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    @rxmarccall Sorry for the very late reply. For some reason I didn't get the notification.

    Regarding your issue, my recommendation would be to add multiple camera targets per "object" in order to cover its dimensions. Let me know if this helps.
     
    rxmarccall likes this.
  15. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,866
    Been using this asset for a while now, and been wondering how to archive panning using controller instead of mouse input. The default panning module does its job for the mouse input but not for the controller input. I can understand configuring input for the panning based on the controller is difficult to do automatically, so what api, ways do you suggest to implement this on my own?
     
  16. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    You can simply create an empty GameObject that you move with your controller, then add that empty GameObject as a camera target. That's pretty much what the PanAndZoom extension does.
     
  17. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,866
    Right. Got it.
     
    luispedrofonseca likes this.
  18. Tom_Bombadil_

    Tom_Bombadil_

    Joined:
    Aug 6, 2018
    Posts:
    44
    Question, I have recently begun using pro camera 2d with a pixel art based game and I am experiencing tearing on the art of my tilemaps. Is there any built in functionality of pro camera that can resolve this?
     
  19. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    159
    I'm using this asset as my main camera control in the game. Works great. I did have a question though.

    I have two targets that camera is following and I want to zoom out camera as targets get further away from each other. Naturally Zoom To Fit is the goto for this behaviour. However, I only want to zoom out to a certain point and then want the camera to leave one of the targets behind and continue to follow the other target. If the followed target then gets back to the target that was left behind I would want the behaviour to reverse (zoom on both targets), like Zoom To Fit does.

    So it is very close behaviour of Zoom To Fit I just want to have one target loose zoom influence (if you understand my meaning) as targets get too far from each other. Any idea what would be the best way to accomplish this using the Pro Camera 2D framework.

    Looking at the framework I think I could just reduce influence of one target as I get further away from it?

    Also, Zoom To Fit does not work when I start to run the scene, it is not active. I have to disable and re-enable it while the scene is running for it to start working. Is this a bug? I'm using latest 2017 Unity on Mac.

    Thanks for the great asset. Regards.
     
    Last edited: May 12, 2020
  20. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
  21. Tom_Bombadil_

    Tom_Bombadil_

    Joined:
    Aug 6, 2018
    Posts:
    44
    @luispedrofonseca I have looked into that extension and it does not seem to be working as I would expect. I am sure it is functional but I can not get it to work. It asks me to add a Pixel Perfect Sprite Component to all of my sprites which shouldn't be an issue but it doesn't let me add it to 2d tilemaps as they do not technically have a sprite renderer. Is there something that can be done for this or would I have be build my entire scene from individual sprites instead of using tilemaps?
     
  22. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    159
    @JesterGameCraft Yes, you should play with the influence of the target that goes away. As for the disabling of the extension on start, that's very odd. Does it also happen in the included demo scene?[/QUOTE]

    It does but I think it might be my fault. If I take the ContentFitter example scene and add Zoom To Fit while scene is running, then Zoom To Fit does not function until I disable ContentFitter. Are these mutually exclusive? It would not surprise me. The behaviour in the example scene is a bit different than in my project though for some reason. In my project if I have content fitter active, start the scene and enable zoom to fit while scene is running, I see that zoom to fit functionality kicks in. I don't see the same in the example scene.

    If extensions are mutually exclusive is there a table that lists which are compatible with which?

    Also, FYI, for me at least, many example scenes have missing prefabs and don't seem to work correctly (for instance Camera Window scene shows that I'm missing a prefab in the scene). I updated/reimported the whole package so have the latest, running Unity 2017.4.39F1 Personal (64bit) on Mac. I don't really care that much about example scenes but figured I would let you know.
     
    Last edited: May 12, 2020
  23. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    @Tom_Bombadil_ You're right, the PixelPerfectSprite can't be added to Tilemaps, but you might not need to. If your camera is on a pixelperfect size and position, as well as your tilemaps (by setting their size correctly), everything should work.

    @JesterGameCraft Yes, there are a few extensions that are not compatible with others. More specifically, extensions that override the size (ContentFitter, ZoomToFit, etc), won't work correctly with other extensions that also need to override the size. There's no table of incompatibilities because it's very limited, but I'll see what I can do about that.

    I'm aware that some example scenes are corrupted on older Unity versions due to the new serialization process on the new Unity - I'll try to fix for the next release.
     
  24. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    159
    Ok. Thanks for getting back.
     
    luispedrofonseca likes this.
  25. Tom_Bombadil_

    Tom_Bombadil_

    Joined:
    Aug 6, 2018
    Posts:
    44
    @luispedrofonseca Hmmm, I will have to keep looking into it. I was thinking it was set up correctly but I am still receiving pretty heavy tearing.
     
  26. Tom_Bombadil_

    Tom_Bombadil_

    Joined:
    Aug 6, 2018
    Posts:
    44
    @luispedrofonseca I have continued to tinker around with it and I am still getting tearing on my tileset. Would you be willing to elaborate on what I need to adjust to make sure that is not happening?
     
  27. archendrus

    archendrus

    Joined:
    Mar 18, 2015
    Posts:
    2
    Hello! I was wondering what would be the best practices for using the pixel perfect extension with text. I have a Player object with a child sprite with Pro Camera 2D pixel perfect sprite script attached. As a child of the Player object I have a world space canvas, a UI image as a child of the canvas, and text mesh pro text object as a child of the UI image.The font is a pixel art font.
    Getting that same image corruption one gets when a sprite is rendered sub-pixel (small pixels, wider pixels).
     
    Last edited: May 18, 2020
  28. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    @Tom_Bombadil_ Can you please contact me through support with a simple project that replicates the issue?

    @archendrus The PixelPerfect extension does not work on TextMeshPro, only on Sprites.
     
  29. Tom_Bombadil_

    Tom_Bombadil_

    Joined:
    Aug 6, 2018
    Posts:
    44
    @luispedrofonseca I was able to tinker around with it some more and it appears to be an incompatibility with the pixel perfect extension and the content fitter extension. Is this a known incompatibility and is there any way to replicate the functionality of the Content Fitter extension with other components?
     
  30. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    @Tom_Bombadil_ Yes, they're incompatible because both need to change the camera size. PixelPerfect needs the camera to be at a certain size to maintain the pixels in the correct size, and the ContentFitter resizes the camera to fit your content. You can't use both at the same time unfortunately.
     
  31. Tom_Bombadil_

    Tom_Bombadil_

    Joined:
    Aug 6, 2018
    Posts:
    44
    Okay that makes sense, sorry for all the confusion and questions. I am new to this whole thing. I guess instead of reporting vague problems I should probably tell you what I am trying to accomplish and see if you can give me advice on the best way to go about it. I am working on a very low res (8 pixels per unit) project in which I want the screen resolution to be fixed at exactly 320 by 180 (40x22.5 units) at all times with the camera always aligning at an exact pixel. I also want to be able to use the cinematic and room extensions. Each room would be at least 320 by 180 so I wouldn't have to worry about zooming but may be larger. In the case where it is larger the viewport would remain at 320 by 180 and merely move around the room. If you are familiar with how the camera works in Celeste that is what I am going for. Is this something that can be done with your system? So far I have either had the issue where the viewport is not the right size (typically 39x22 or as large as 45x25.5) which messes with the level or when I was able to get the size exactly right there was terrible tearing of the pixels. If you would be able to give me any pointers that would be greatly appreciated as I have been working with this for a little bit now and I can not quite wrap by head around how it is functioning.
     
  32. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    @Tom_Bombadil_ The issue is that resolution will only fit perfectly on 16:9 resolutions. You have to design your game while considering all possible aspect ratios.
     
  33. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    159
    Hello. I have a particular scenario I wanted to get your opinion on. Imagine an object falling to ground. Camera follows the object that is 100% target. The object is in the middle of the screen. However when the object gets to the ground I would like the camera to stay above the ground and not follow the object. I would like the camera to take ground into account and stop so that the object and the ground are towards the bottom of the screen and not in the middle. Do you have a suggestion on how to accomplish this with your framework? Also if the object bounces from the ground and flies up I would like the camera to start following it again so that it’s in the middle of the screen again.

    Thank you for any suggestions you may have. Regards.
     
  34. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    @JesterGameCraft Sure, simply add the NumericBoundaries extension to prevent the camera from going beyond the ground (a Y value). Let me know if you have any other question.
     
  35. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    159
    Hi, Thank You for getting back. That works perfectly.

    One thing I found however is if I have 4 different targets that I'm tracking and have Zoom To Fit extension (only this extension is enabled) I get a problem with zoom in. If I have influences of only two targets set to 1 and the other to 0 the extension does not zoom in completely on the two targets with 1 influence. If I remove the other two targets that have influence set to 0 then I see the zoom kick in. It's like Zoom To Fit is ignoring the influence settings of the two targets that are set to 0. Here is a snapshot of my settings. I would expect that if influence of Projectile/Tower targets are set to zero the zoom should completely be controlled by Player/Enemy targets. Is this expected behaviour?

    Screen Shot 2020-06-08 at 7.31.47 PM.png
     
    Last edited: Jun 9, 2020
  36. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    @JesterGameCraft - "It's like Zoom To Fit is ignoring the influence settings of the two targets that are set to 0" - That's exactly what it should do. Targets with zero influence are ignored.
     
  37. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    159
    I guess my post was not clear. What I meant is that the targets are never ignored by Zoom To Fit, even if their influence is set to 0. So basically their influence setting is ignored, does not matter if its value is 1 or 0 the influence is ignored and they are always considered in the Zoom To Fit calculations, unless they are down right removed from the target list.

    I'll give an example, you have 3 targets (a, b and c). Influence settings are: a-set to 1, b-set to 1, c-set to 0. Zoom To Fit ignores the 0 value for c and behaves as though it is set to 1. If c is removed from the target list completely then its influence on Zoom To Fit vanishes.

    Maybe it's just something I'm seeing?
     
  38. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    @JesterGameCraft You're right, just confirmed and it seems to be a bug. I'll have a look at it.
     
  39. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    159
    Thanks. If you would like me to test a build let me know. Can DM Invoice#.
     
  40. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
  41. kemijo

    kemijo

    Joined:
    Apr 7, 2014
    Posts:
    11
    Hello everyone,

    I am using the ProCamera 2D for the first time, primarily for the pixel perfect features. My screen resolution is vertical/portrait style. Everything works great in editor play mode, but when I build and run to Web GL, either all my sprites look like they are double size or the camera has zoomed in. The window border/game size looks to be correct, so it has the effect of "cropping" the game.

    I'm uploading a test created from the pixel perfect demo scene, and a screen shot showing the difference between game mode and webGL. All I've done is changed the resolution to 224x320 on both the pixel perfect component on the camera and in player settings (I've also increased the sprite scale on the player so its easier to see). Same problem. Does ProCamera2D support vertical resolutions?

    Thanks in advance!
     
  42. UnityMaru

    UnityMaru

    Community Engagement Manager Unity Technologies

    Joined:
    Mar 16, 2016
    Posts:
    669
    I've had to delete your project attachment because it is including free assets. Please strip your uploads of commercial assets as sharing there are against our ToS.
     
    luispedrofonseca likes this.
  43. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
  44. kemijo

    kemijo

    Joined:
    Apr 7, 2014
    Posts:
    11
    Sorry about that UnityMaru! And thanks Luis I will be in contact today.
     
  45. liquidsht

    liquidsht

    Joined:
    Jun 4, 2020
    Posts:
    47
    Probably very noob question. I setup parallax as per the user guide but the layers are not moving.
    upload_2020-7-7_22-13-53.png

    Is there anything i need to do to activate it? Thanks.
     
  46. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    164
    @liquidsht This might be a silly question (great name by the way) - but have you set the Layer property of each of your background layers? I've forgotten to set that in the past.
     

    Attached Files:

  47. liquidsht

    liquidsht

    Joined:
    Jun 4, 2020
    Posts:
    47
    I did, I am using background and background 2-4 for my parallax.

    upload_2020-7-7_22-42-5.png
     
  48. vonchor

    vonchor

    Joined:
    Jun 30, 2009
    Posts:
    68
    Do you have plans to update Procam to use the new input system? Right now it's hardcoded to the old one only, and throws errors ie at lines with code like "Input.mousePosition.x" or do you have a workaround?

    The new input system is a verified package at this point in time.
     
  49. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    860
    @vonchor Didn't know that the new Input system was already verified. In that case, I'll add support for it as soon as possible. Sorry for the inconvenience.
     
  50. vonchor

    vonchor

    Joined:
    Jun 30, 2009
    Posts:
    68
    Not a problem - I can keep using the old input system for now. But eventually they'll deprecate the old one.
     
    luispedrofonseca likes this.
unityunity