Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    427
  2. Hale88

    Hale88

    Joined:
    Jan 5, 2016
    Posts:
    5
    @luispedrofonseca Hey man, not sure if you know about it but I found a bug where if you pass through a trigger boundary while the camera is still transitioning to its new numeric boundaries the thing seems to bug out. By that I mean focus on nothing/ignore the target, sometimes it just returns to the original numeric boundary and then seems to ignore any other ones as well as stop moving with the given target.

    I have this bug on my project and can even recreate it in your demo on your website as well. To recreate it on your demo set the transition time to 2 and then quickly move between the two triggers that are side by side.
     
  3. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @Hale88 Hi, thanks for the bug report!
    I wasn't aware of this issue. I'll add it to the to-do list and fix it ASAP.
     
  4. Hale88

    Hale88

    Joined:
    Jan 5, 2016
    Posts:
    5
    @luispedrofonseca Thanks man, please let me know when it is fixed so I can update the plugin in my project as its kinda of a big bug for me right now.
     
    luispedrofonseca likes this.
  5. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @Hale88 The issue you reported is fixed and will be part of the v2.0.4 release. If you'd like to get early access please contact me directly with your invoice number and I'll send you the new version.
     
  6. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hi,

    I have an issue and not sure is CameraPro2D fault but it is worthy to ask. I have a 2d games with different layer of parallax - I want to check when my character enter/exit certain area by adding box collider 2D into empty game objects that represent those areas. All colliders (areas and character) are in trigger mode and detection work fine except that the parallax seems to not "move" colliders even if the collider game object is correctly assign to a specific layer - which it's not the same as the character. So detections happened but visually the character does not seem to have entered/exit those areas.

    Does ProCamera2D Parallax plugin move object or only move cameras ?

    Thanks
     
  7. Hale88

    Hale88

    Joined:
    Jan 5, 2016
    Posts:
    5
    luispedrofonseca likes this.
  8. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @Kiupe That's a very good question. In fact, like you said, ProCamera2D Parallax extension does not move the objects, it only moves the cameras.

    This results in a much better performance and not dependant on the number of objects you have. With typical parallax systems you might end up having performance issues if you move too many objects.

    This means that collision detection should only be done on the main layer, because it's the only layer that "physically" represents what's showing on screen.
     
  9. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Ok I get it and it makes sense !

    Thx
     
  10. manvsrice

    manvsrice

    Joined:
    May 17, 2016
    Posts:
    5
    Hello, I have been playing around with CameraPro2d today and it has been working great. However, now suddenly trigger boundaries have stopped working in my scene?! I tired removing the camera and all boundaries and re-adding them, still not working in this scene. The demo scene in examples is still working. Is there some rookie mistake I have made that disable Triggers from working?

    I think this started happening with the update today? I am new to unity so I just pressed import and updated straight away... I tried deleting the package and then reimporting CameraPro2d but its still not working.. Is my scene remembering something it shouldn't?

    If I press the "Set as starting boundaries" the boundaries are set, but if not the trigger seems just to be ignored.

    Update: Did try to make a new scene and it doesn't seem to work there either for me.. :(. The example scene does work though, I am very confused.

    Update 2: I found an option in Unity "Reimport all assets". It took a while, but after that it works again! :)

    I will just leave my comment here if anybody else should bump into this problem. Thank you for a great Asset Luis, its really cool! :)
     
    Last edited: May 17, 2016
  11. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    Hi,

    I have an issue when trying to access to the ProCamera2DTransitionsFX plugin. I have 2 scenes, both are using ProCamera2D and the ProCamera2DTransitionsFX plugin.

    When my first scene starts I manually call " ProCamera2DTransitionsFX.Instance.TransitionEnter ()" and later, when the player clicks on a door to access to the next scene I call ProCamera2DTransitionsFX.Instance.TransitionExit (). When the transition is complete I remove the listener and then load my next scene.

    When the next scene is loaded and the code execute " ProCamera2DTransitionsFX.Instance.TransitionEnter ()" I have an error :

    MissingReferenceException: The object of type 'ProCamera2DTransitionsFX' has been destroyed but you are still trying to access it.

    Any idea why ? I think the issue is caused by the fact that ProCamera2D script is a singleton - so when the first scene is destroyed the static reference is lost - so when the second scene is loaded an tries to access to it and access to the plugin reference the application crashs.

    Thanks
     
  12. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    In order to fix my issue ( maybe I'm using ProCamera2D the wrong way) I added in the ProCamera2DTransitionsFX script the following code :


    Code (CSharp):
    1. void OnDestroy()
    2. {
    3.      _instance = null;
    4. }
     
  13. Jay11

    Jay11

    Joined:
    Aug 8, 2015
    Posts:
    7
    @luispedrofonseca

    Hi,

    Quick question: I'm using the cinematic extension in my project, and I'm have an issue when the cinematic finishes, it does not return to its original position. My camera has no target to follow and only one cinematic target, and the camera only returns to the same z coord but not x nor z after cinematics :(

    Is this a known issue or I am doing something wrong??

    Also, how can i get notified when a cinematics is finished and camera is returned to its original position?
     
    Last edited: May 22, 2016
  14. wjone52

    wjone52

    Joined:
    May 4, 2016
    Posts:
    4
    Asset looks great
    One quick question before I buy: Is there any reason it would cause problems for me to enable and disable specific triggers during runtime? For my project I will need some of them to only enable after certain events occur.
     
  15. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @manvsrice @Kiupe @Jay11 @wjone52 I'm VERY sorry for the late reply but for some weird reason the forum stopped sending me email notifications. Now to your questions:

    @manvsrice To make sure an upgrade goes smoothly. The best way is to:
    1) Open a new empty scene
    2) Delete ProCamera2D from your project (You might start getting errors on the console, but ignore them)
    3) Import the new version

    @Kiupe That sounds like a bug! Your workaround should fix it. I'll make sure this is part of the next release. Thanks for the report!

    @Jay11 That sounds like a bug too! I believe I never tested using a cinematic without a target, so that may be the reason. I'll fix it and add it to the next release. Thanks for the report!

    @wjone52 You can enable and disable triggers at any time during runtime.
     
  16. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @Kiupe I've tried to replicate the bug you mentioned but I can't. This is the code I'm using:

    Code (CSharp):
    1. using UnityEngine;
    2. using Com.LuisPedroFonseca.ProCamera2D;
    3. using UnityEngine.SceneManagement;
    4.  
    5. public class Transition : MonoBehaviour
    6. {
    7.     ProCamera2DTransitionsFX _transitionsFX;
    8.  
    9.     void Start()
    10.     {
    11.         _transitionsFX = ProCamera2D.Instance.GetComponent<ProCamera2DTransitionsFX>();
    12.         _transitionsFX.OnTransitionExitEnded += OnTransitionExitEnded;
    13.         _transitionsFX.TransitionEnter();
    14.     }
    15.  
    16.     void Update()
    17.     {
    18.         if (Input.GetKeyDown(KeyCode.Space))
    19.         {
    20.             _transitionsFX.TransitionExit();
    21.         }
    22.     }
    23.  
    24.     void OnTransitionExitEnded()
    25.     {
    26.         _transitionsFX.OnTransitionExitEnded -= OnTransitionExitEnded;
    27.         SceneManager.LoadScene("YourSceneName");
    28.     }
    29. }
    Can you please send me a sample project that replicates the issue? (Assuming this doesn't work for you)
     
  17. mikkifr

    mikkifr

    Joined:
    Oct 28, 2013
    Posts:
    3
    Hey Luis,

    Is there a way to set the origin/pivot/anchor of the ProCamera? I'm creating a side scroller and I'd like the camera to zoom in/out using the bottom left corner as it's origin. I can't seem to be able to figure it out!

    I've attached an illustration of what I'm looking to do.

    Thanks!
     

    Attached Files:

  18. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    Hi @mikkifr, thanks for using ProCamera2D!

    At the moment there's no built-in function to specifically allow you to do that. However, a way to implement it would be to use the Numeric Boundaries extension and put a Left boundary. This way the camera won't move the left side when zooming in-out. Not sure if that suits your game but let me know.
     
  19. NAYIR55

    NAYIR55

    Joined:
    Oct 5, 2014
    Posts:
    9
    Hello...
    Very well done with your asset
    I have a little problem, I noticed the Pro Camera (Script) can accept prefabs.. but when the prefab is instantiated the camera doesn't work, the camara isn't following the player or it jumps elsewhere and it stucks, and even if I attach the Pro Camera component to the prefab to be instantiated doesn't work
    What can it be?
    Help
     
  20. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @NAYIR55 The reason for that is a prefab is a special Unity object that "lives" outside the scene. When you instantiate it on your scene, it's a clone and not the object itself.

    The way to do it is by manually adding your target once you instantiate it:
    Code (CSharp):
    1. ProCamera2D.Instance.AddCameraTarget( YourPrefab.transform );
     
  21. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
  22. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @mgear There's not a specific "platform-snapping" feature, but you can achieve the same using the Boundaries Trigger. You'd basically place triggers on your platforms and once your camera target touches it, the bottom boundary of the camera will move to that new position.

    You can also do it programmatically, if you're comfortable, just by adjusting the values of the Numeric Boundaries extension.
     
  23. jackfreak

    jackfreak

    Joined:
    Dec 22, 2014
    Posts:
    2
    @luispedrofonseca Hey Luis, I was wondering what would be the best way to disable all target following (not including the extensions). What Im trying to do is make the camera stop following my character when he dies, and when the character is resurrected at the last checkpoint make the camera start following it again. A good example would be like in Super Mario Bros, when Mario dies he just falls out of the screen and the camera doesnt follow, it just stays still. Then he respawns and the camera starts following him again.

    I tried
    Code (CSharp):
    1. ProCamera2D.Instance.AdjustCameraTargetInfluence(player.transform, 0f, 0f);
    but that made the camera go back to it's default location and that's not really what I want, I just want the camera to stay still in the last position it was when I "deactivate" the target following.

    Thanks!
     
  24. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @jackfreak You can simply remove the target and then add it again once it respawns. Would that work for you?
     
  25. Seiraniel

    Seiraniel

    Joined:
    Dec 23, 2014
    Posts:
    13
    I have a weird issue with the transitions. The effect itself works but the camera is turned upside down and split into four while it lasts.
     
  26. firebelly

    firebelly

    Joined:
    Apr 22, 2013
    Posts:
    12
    Do you have any idea why my transitions would stop working recently? They used to fade correctly, but now when I try them, they don't fade, they just appear black for the duration then disappear. It's simply either on or off. I'm going to do some debugging on my own for now.
     
  27. firebelly

    firebelly

    Joined:
    Apr 22, 2013
    Posts:
    12
    (installed latest on blank scene after deleting old)

    So I created a new scene, added camera pro, added transitionFX. Added a sprite. The Fade works fine, but it's only fading between the camera BG color and the FX color, it's not fading alpha on my system. Is there something I did to stop the Alpha fade?

    I used to be able to see the image through the fade.
     
  28. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @Seiraniel @firebelly v2.0.5 introduced an issue with the TransitionsFX. Please contact me with your invoice number so I can send you the latest update v2.1.0 that resolves the problem. Thanks!
     
  29. NAYIR55

    NAYIR55

    Joined:
    Oct 5, 2014
    Posts:
    9
    Sorry to bother... but, i'm not a great programmer, where do i write that line of code??
     
  30. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @NAYIR55 You can write that code anywhere... But you probably want to do something like this:

    Code (CSharp):
    1. using Com.LuisPedroFonseca.ProCamera2D;
    2.  
    3. public class CreatePlayer :  MonoBehaviour
    4. {
    5.         void Start()
    6.         {
    7.             // Instantiate your player prefab here
    8.  
    9.             // Add player to camera
    10.             ProCamera2D.Instance.AddCameraTarget(MyPlayer);
    11.         }
    12. }
     
  31. vivalavida

    vivalavida

    Joined:
    Feb 26, 2014
    Posts:
    85
    Hi @luispedrofonseca
    Been noticing a strange behavior off late.
    In the unity editor when I change scenes the values in Camera Shake Preset persist between multiple scenes.
    the values(preset name) of the current scene don't always reflect, this causes a lot of confusion.

    Same goes for Rails. if moved in one scene there are times when these get moved in all scenes.
    Is this a known bug?

    Unity version 5.2.0
    Procamera2d version 1.8.1

    (if it's possible we do not want to upgrade the packages as we're nearing release, and also, we currently use unity asset server which is a real pain when it come to modifying assets)
     
  32. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @vivalavida Yeah, that's a known bug that was fixed on a recent release. Unfortunately there's not much I can do if you can't upgrade to the latest... =/
     
  33. vivalavida

    vivalavida

    Joined:
    Feb 26, 2014
    Posts:
    85
    yes i just saw your change log i guess you fixed it in 2.0.2
    will try and upgrade. Is there a new version coming soon?
    (alternatively; this is probably too much to ask but is there any script that i could tweak around/replace ?)
     
  34. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @vivalavida A new version was released today, v2.1.0.
    I'm always working on new features and improvements so you can expect new releases pretty often.
    Your version is a bit outdated so there's no file you can easily replace to make it work. The safest bet is a complete upgrade. Remember to backup of course.
     
    vivalavida likes this.
  35. jhc1520

    jhc1520

    Joined:
    Jul 1, 2016
    Posts:
    2
    I have the same issue , did you figure out how to do it?
     
  36. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @jhc1520 Not exactly sure what you need. Feel free to contact me through support. I'll help you out.
     
  37. startleworks

    startleworks

    Joined:
    Jun 8, 2013
    Posts:
    34
    Hi Luis. What would be the best way to have ProCamera2D setup with Pan And Zoom plugin while also working on the XZ axis?

    So far, I've tried adding ProCamera to my ortographic camera, rotating the camera 90 degrees(so I can see the objects under the camera) on the X axis and activating Pan And Zoom, but this only pans on the X axis, the Z remains unchanged. What am I doing wrong?
     
    Last edited: Jul 16, 2016
  38. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @saruzaru You're right, sorry! Nasty bug introduced on a recent update. Working on it and I'll let you know once it's fixed.

    [EDIT]
    The bug is fixed and will be part of the next release. If you need it earlier please get in touch and I'll send you an updated version.
     
    Last edited: Jul 17, 2016
  39. startleworks

    startleworks

    Joined:
    Jun 8, 2013
    Posts:
    34
    luispedrofonseca likes this.
  40. Krzsiek-Siewiorek-Tate

    Krzsiek-Siewiorek-Tate

    Joined:
    Nov 17, 2015
    Posts:
    15
    I've found collision between two scripts build in Pro Camera 2D, that is actualy pain in the ass to me.
    The problem appears when using Speed Based Zoom and TriggerZoom in the same time.
    When trigger's value is out of bounds of speed based zoom's values, the camera jiggles forward and backward. I've attached modified scene from your examples to show you the problem.
    I look forward to see it fixed. Thanks!
     

    Attached Files:

    luispedrofonseca likes this.
  41. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @Krzsiek-Siewiorek-Tate You're right. It's a known issue, sorry! Those two extensions conflict with each other because they're both trying to change the zoom at the same time.

    My goal with the extensions and triggers is to maintain them as independent as possible, but there are a few rare cases, like the one you described, that need special cases.

    That issue will soon be resolved in an upcoming update (can't give you a release date at this stage).
     
  42. Krzsiek-Siewiorek-Tate

    Krzsiek-Siewiorek-Tate

    Joined:
    Nov 17, 2015
    Posts:
    15
    Thanks. I can't wait for the update then ;)
     
  43. redcap

    redcap

    Joined:
    Jul 5, 2012
    Posts:
    53
    Quick question for anyone who knows, I am trying to use zoom to fit targets with adding and subtracting targets dynamically via code. Any way to do this?
     
  44. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
  45. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Hey @luispedrofonseca
    is it generally ok to move the whole ProCamera2D Folder to a /Plugins Folder in order to save compile time?
     
  46. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @BTStone Yes, you should be able to put ProCamera2D folder anywhere you'd like. The only folder that has to remain on the same place is the Gizmos/ProCamera2D folder.

    The drawback of moving the folder around is that Unity will get confused if you decide to upgrade to a newer version. Any how, it should be just a matter of moving it back to the root and performing the update.
     
    BTStone likes this.
  47. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    I've updated the promo video to reflect the changes since v1.6. Let me know what you think.



    BTW, I'm planning to add a new extension (Rooms) that will make much easier to create rooms (duh!). The current workflow with the boundaries trigger is far from ideal and a bit cumbersome. I'll keep you posted!
     
    Bhanshee00 and Bagnol like this.
  48. Bagnol

    Bagnol

    Joined:
    Sep 5, 2013
    Posts:
    169
    @luispedrofonseca The video looks great - if I hadn't already bought the asset, I feel it would be a very effective showcase. Super excited to hear more about the Rooms extension! :D
     
    Bhanshee00 and luispedrofonseca like this.
  49. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    Hey guys, just to let you know that for the next couple weeks things will slow down a bit. I'm taking 2 weeks off and I won't have access to email very often. Please excuse any delays.
     
    Bagnol likes this.
  50. winsock

    winsock

    Joined:
    Mar 21, 2013
    Posts:
    3
    Hello @luispedrofonseca ,i have a question about "Pan and Zoom",
    have any way to set a border to Pan?
    I look your demo,looks like it can infinite pan.....