Search Unity

[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. johannig

    johannig

    Joined:
    Apr 22, 2015
    Posts:
    27
    Parallax layers are not showing up for some reason. I've removed them from the culling mask on the main camera and everything seems to be in order. Any idea what's creating this problem?

    Screenshot 2020-09-22 at 14.04.46.png
    Screenshot 2020-09-22 at 14.04.57.png
    Screenshot 2020-09-22 at 14.05.11.png
     
  2. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    @johannig It seems you're using the new URP, which is currently incompatible with the Parallax and TransitionFX extensions. I'm sorry about the inconvenience, but I do have planned an update to add support for it.
     
    johannig likes this.
  3. johannig

    johannig

    Joined:
    Apr 22, 2015
    Posts:
    27
    Oh sorry, hadn't seen that yet. Glad there's an update coming soon! :)
     
    luispedrofonseca likes this.
  4. Stilghar

    Stilghar

    Joined:
    Feb 4, 2013
    Posts:
    82
    @luispedrofonseca any updates on this? Unity 2019 is now on LTS, I assume it is stable now or there are still things preventing the updates for ProCamera2D?
     
  5. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    @luispedrofonseca Is it possible in a future update to add UnityEvents on ProCamera2DRails extension when the rails are enabled/disabled, i.e. at ProCamera2DRails.EnableTargets() and ProCamera2DRails.DisableTargets() ?
     
  6. FireMutant

    FireMutant

    Joined:
    Sep 2, 2013
    Posts:
    49
    Hi, is there a way to keep the shaded rectangle bounds of the camera (from ProCamera2DContentFitter) viewable in the Scene window without having the Camera selected in the Hierarchy? If not, is this a possible feature in the future. It is very helpful while laying out a scene to visualize the camera's boundaries, even though they may change depending on the device's resolution.

    Thanks!
     
    Last edited: Sep 28, 2020
  7. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    @Stilghar You're right. It should be stable now, I'll look into it.

    @Nikaas I'll add it in a future update. Can it be regular C# events instead?

    @FireMutant The only way I can think of is to open two Inspector panels and on one leave the camera selected.
     
    Bagnol likes this.
  8. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    Sure, they are fine too. I said UnityEvents because I saw them at the Rooms extension. Anyway UnityEvents are a pain in custom inspectors. Their gameObject drag and drop does not work with custom inspectors, only object select window.
     
    luispedrofonseca likes this.
  9. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    Noticed a bug related to the Rails extension and prefabs variants (2020.1.6 and 2020.2.0 beta)

    1. Create camera prefab.
    2. Create variant of the prefab.
    3. Make scene copy of the variant prefab.
    4. Modify rails path in the scene.
    5. On scene instance of the prefab click Override -> ProCamera2DRails.

    When you click 5, the path gets restored to default state.

    Similar thing happens when trying to disable extensions. Add extension at the variant level. Then start transitioning between base->variant->scene. If you try to disable some extension (through the enable/disable buttons) it will get reenabled after you do back and forth transitions between scene<->variant. If you remove the component the usual way it does not happen.
     
  10. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    @Nikaas I'll have a look at that and see what I can do. Not sure if it isn't a bug with Unity's prefab system.
     
  11. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    BTW if that would help I just noticed that after unpacking the variant and the base prefab (i.e. pure scene object) the rails path that I edit at the scene is still applied to the variant prefab. Variant path change though is not applied to the scene.
     
    luispedrofonseca likes this.
  12. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    @Nikaas Those are certainly related issues. I'll see what I can do about it.
     
  13. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    2 questions.

    Is it possible to zoom absolutely vs always relative? I want to do: ProCamera.Zoom(10) and have that always zoom to the same "level". Currently, it seems to only allow me to zoom relative to the current zoom factor.

    Is it possible to read the current zoom level?

    Why I ask:
    I have a character that skis... when he crashes, I zoom in. Then, when I reset, I need to zoom back to the baseline.

    I would prefer to not have to keep track of the relative zoom amounts as I may zoom in/out for various reasons. Plus, if I have to reset the zoom when a zoom is in transition, then I'm not sure how to calculate the amount required to back-out the zoom to my original.

    -Jeff
     
  14. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    @jeffweber You can use the "UpdateScreenSize" method to directly set the camera size. The "Zoom" method is always relative by definition.
     
    Last edited: Oct 14, 2020
    jeffweber likes this.
  15. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    362
    Hello @luispedrofonseca

    i have a strange issue, i'm using transitions fx on my main camera. When i start the game i use transition exit, and when level is loaded i use transition enter. Then i go back to main menu (main camera is singleton, i use a bootstrap menu) and when i call the transition exit it doesn't happen. On level loaded transition enter still happens normally.

    You can find the example in the video. I get no warnings or errors in the log.

    Unity is 2018.3.7., PC2D is 2.6.5.

     
    Last edited: Oct 15, 2020
  16. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
  17. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    362
    Still not working, submitting the report.
     
  18. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    @luispedrofonseca

    I have a feature request unless you can show me a way I can do this with the current system.

    I have a large world that requires me to occasionally shift my origin in order to avoid floating point inaccuracies.

    When I origin shift, I translate everything in the world by some amount and need to do the same with ProCamera2D.

    I tried just translating the underlying ProCamera2D transform and of course that did not work because I have smoothing enabled and that does not account for your internal variables related to smoothing.

    I also tried 'MoveCameraInstantlyToPosition', but that does not quite work either because it resets the smoothing variables and causes a noticeable visual glitch when the origin shift happens.

    The only way I could get this to work was adding my own method to ProCamera2D:

    Code (CSharp):
    1. public void Translate(float x, float y)
    2.         {
    3.             _transform.localPosition += new Vector3(x, y, 0);
    4.  
    5.             CameraTargetPosition += new Vector3(x, y, 0);
    6.  
    7.             _cameraTargetHorizontalPositionSmoothed += x;
    8.             _cameraTargetVerticalPositionSmoothed += y;
    9.  
    10.             _previousCameraTargetHorizontalPositionSmoothed += x;
    11.             _previousCameraTargetVerticalPositionSmoothed += y;
    12.  
    13.             TargetsMidPoint += new Vector3(x, y, 0);
    14.             PreviousTargetsMidPoint += new Vector3(x, y, 0);
    15.         }
    This worked perfectly. Could you add a method that does this?

    -Jeff
     
  19. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    @jeffweber Actually, just very recently I had another client asking me exactly the same thing! That's not part of the core component, but I can definitely see the benefit for it.
    Would you mind me adding your code (with some slight changes)?
     
  20. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    I don’t mind at all. Thanks.
     
    tosiabunio likes this.
  21. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Should TranstitionFX be working with the Universal Pipeline yet? Nothing happens for enter or exit, but if I trace the code I can see it's hitting the coroutine correctly and incrementing/decrementing the transition values correctly.

    I"m using 2020.1.9.

    Here are my camera settings:
    Transition.PNG
     
  22. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    @luispedrofonseca
    Any ideas on the above. This would be really useful for me but if TransitionFX does not support URP I'll need to roll my own solution.

    Thanks

    Jeff
     
  23. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    @jeffweber That is correct. TransitionFX and Parallax extensions are not supported on URP (or HDRP) yet. I have plans to implement them but no timeline estimate yet.
     
    jeffweber likes this.
  24. mk7gwc

    mk7gwc

    Joined:
    Mar 3, 2016
    Posts:
    27
    hello
    i have a question.

    If using CenterOnTargets() ,the camera will move to the target instantly,
    Is it possible to move smoothly instead of instantly?
     
  25. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    @mk7gwc Not through that method. Can you please explain what you're trying to achieve? There's probably another way to do it.
     
  26. mk7gwc

    mk7gwc

    Joined:
    Mar 3, 2016
    Posts:
    27
    @luispedrofonseca
    OK
    https://drive.google.com/file/d/1jQ77O03Kuw966Ii6i3dfQZ947gfLqVTw/view?usp=sharing

    As you can see from this video, we are currently using the "Camera Window" feature of Procamera 2D to follow when the target goes out of a certain area.


    The target stays at the very limit of the range. In the case of this video, it is difficult to see the upward direction. Therefore, for example, if the character is on the floor for a few seconds, we want the camera to move smoothly to the center.
     
  27. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
  28. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    @mk7gwc Apart from dynamically resizing the camera window to zero (and then back to the current size) I'm not seeing any immediate solution for your problem. However, this is an interesting problem to solve and I'm there are other users who could benefit from a better solution. I'll give it some thought and see what I can come up with.

    @Aurigan Thanks, I'll reply there.
     
  29. mk7gwc

    mk7gwc

    Joined:
    Mar 3, 2016
    Posts:
    27
  30. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    @luispedrofonseca
    I just grabbed the latest version of ProCamera2D that has the new "TranslateCamera" method. I think there is a bug with that method.

    When I call that method, it ends up shifting my camera on the Z axis.

    Looking at these two lines:
    var currentPos = _transform.localPosition;
    var newPos = currentPos + VectorHVD(translateAmount.x, translateAmount.y, Vector3D(currentPos));

    If translateAmount is (300,300) and currentPos = (10,10, -60)
    Then newPos = (310, 310, -120)

    Then you do:
    _transform.localPosition = newPos;

    Which pushes my camera back to -120.

    -Jeff
     
  31. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Hmmm...
    I also think this logic does not quite work:

    _transform.localPosition = newPos;
    CameraTargetPosition = newPos;
    TargetsMidPoint = newPos;
    PreviousTargetsMidPoint = newPos;

    Here you are setting the CameraTargetPosition = newPos, but what if localPositon and CameraTargetPositon were not equal prior to the translation

    I think you need to translate all values separately.
     
  32. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Bumping this for @luispedrofonseca
    Not sure you saw this, but would love a fix in future version so I don't have to use my own logic.
     
  33. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    Thanks for the heads-up @jeffweber! Sometimes I stop getting notifications from the forum for some weird reason. I'll see what I can do about that bug.
     
  34. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,943
    Hi @luispedrofonseca
    I have a game with a 3d grid in isometric view, that 3d grid provide a bounds property.

    I have a Canvas UI with
    - Header (Part of Scale with Screen Size uGUI)
    - Content Area (this is where my 3D element will appear)
    - Footer (Part of Scale with Screen Size uGUI)

    and i want to "fit" that 3D grid inside the content area perfectly by manipulating camera.

    1.png

    Your plugin seems to offer all these but may require an example scene cater to above needs?
    So if i buy the plugin, can you please provide support for above usecase?

    Thanks
     
  35. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    @jGate99 That seems feasible. If you encounter some trouble getting it to work let me know.
     
  36. johannig

    johannig

    Joined:
    Apr 22, 2015
    Posts:
    27
    Any idea when parallax will be supported on URP? It's been creating a bit of a bottleneck for me the past couple of months o_O Cheers!
     
  37. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    Unfortunately I don't have a timeline yet, but hopefully soon if time permits! Sorry about the inconvenience.
     
    johannig likes this.
  38. MSavioti

    MSavioti

    Joined:
    Dec 27, 2017
    Posts:
    4
    Hi @luispedrofonseca

    I'm having trouble on making
    RemoveCameraTarget(Transform)
    work.

    upload_2020-12-15_12-29-12.png

    upload_2020-12-15_12-31-51.png

    Am I doing it like it's supposed to? Thanks.
     
  39. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
  40. jflejmer

    jflejmer

    Joined:
    Mar 1, 2015
    Posts:
    6
    Are there any updates on rotated camera? It was mentioned on the forum couple of times over the years but I didn't find anything on it
     
  41. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    @jflejmer I actually explored that possibility a couple of years ago, but it ended up being too complex as it would require a large rewrite since it would essentially make it 3D camera.
    Like I said before, it can be used outside of the predefined rotations/axis (XY, XZ and YZ), but some calculations will be offset. Many customers have done it, but it's not officially supported.
     
  42. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    361
    Do you have plan to adopt asmdef? Currently I have to restructure your source and add asmdefs manually. Though it's quite easy since I don't have to edit your code, it's still tiresome everytime I update to the latest version.
     
  43. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    @Laicasaane I haven't thought of that to be honest. Can I ask what are the benefits? If it's to speed up compilation time, you can put the ProCamera2D folder in the Plugins folder and that should make it only compile once.
     
  44. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    361
    It's not about the compilation speed actually. The main reason is I've been using asmdef in every projects, and any asset not adopt asmdef makes it impossible to be referenced in the main project. (Asmdefs can be auto referenced in Assembly-CSharp, but not vice-versa.) The second reason is with asmdefs I can make ProCamera2D a package and put it in the [project]/Packages folder for Unity to exclude it from the C# solution, thus reduce the workload for Visual Studio. Or I can unload specific .csproj in the solution and that can also reduce the workload.
    upload_2021-2-25_18-8-16.png
     
  45. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    361
    The other benefit is with asmdefs, you can choose to exclude some .dll from the build. For example, I want to retain ProCamera2D example codes in my project so I can easily examine them when needed, but I don't want to include example codes in the final build. For that I will move all examples to a folder named ProCamera2D.Examples and put an asmdef into it then uncheck every platform.
    upload_2021-2-25_18-19-59.png
     
  46. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    943
    @Laicasaane I see, thanks for the explanation. Makes a lot of sense. I'll add it to the next release. Can you show me how you'd prefer the asmdef's to be setup?

    As for including the example scenes in the final build, from what I understand they're automatically excluded, as is everything else that is not part of the Build settings. So as long as the example scenes are not on that list you should be good.
     
  47. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    361
    I think this structure is ideal
    Code (CSharp):
    1.  
    2. .
    3. └── ProCamera2D/
    4.     ├── Editor/
    5.     │   ├── ProCamera2D.Editor.asmdef
    6.     │   └── ...
    7.     ├── Runtime/
    8.     │   ├── ProCamera2D.Runtime.asmdef
    9.     │   └── ...
    10.     ├── Presets/
    11.     │   └── ...
    12.     ├── TransitionFX Textures/
    13.     │   └── ...
    14.     ├── Examples/
    15.     │   ├── ProCamera2D.Examples.asmdef
    16.     │   └── ...
    17.     └── 3rd Party Plugins/
    18.         ├── PlayMakerActions/
    19.         │   ├── ProCamera2D.Plugins.PlayMakerActions.asmdef
    20.         │   └── ...
    21.         └── ...
    22.  
    I'm afraid it's not, or at least with asmdefs, I've tested this before. For example, even though the ProCamera2D.Examples.asmdef is nowhere referenced, the ProCamera2D.Examples.dll is still included in the final build.
     
    luispedrofonseca likes this.
  48. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    361
    And I advice to uncheck this box so the asmdef will use names for the references below. Because GUID can change, sometimes unexpectedly.

    upload_2021-2-25_19-6-31.png
     
  49. ununion

    ununion

    Joined:
    Dec 2, 2018
    Posts:
    275
    Hello ,please let me know if the asset support isometric 3d view(camera ruler(30,45,0)) now?if that i will buy it ,thanks~
     
  50. agelvik

    agelvik

    Joined:
    Nov 6, 2015
    Posts:
    23
    hey!
    when i set timescale to 0, i often but not always get this error as shown in the picture. in PC2D component i've set it to ignore timescale.

    this only occurs when Update mode is set to Late Update, is there a reason for that?

    2021_03_03_10-03-11.png