A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Separate names with a comma.
Discussion in 'Assets and Asset Store' started by luispedrofonseca, Jul 29, 2015.
Do you have post processing effects on your cameras?
I do, I use Beautify asset. However, I tested with and without Beautify and it doesn't seem to make much of a difference as far as performance.
Hey, i just bought PC2D and i love it <3, i only have a question, to use the rails you need to drop a target in my case the player, but my player is not in the scene, is called by the level manager, so, is there a way programmatically to use it as a target ?
Sorry if the question is super stupid or was asked before ._ .
You can use these public functions in the ProCamera2DRails class, to add a target while the game is running:
Hey thanks a lot for the help, works great =D
Hi,just bought your asset,got a question here:
Is it possible to change the camera axis during runtime?
@kiteorca To be honest, I've never tried it. In theory it should be possible, but I'm guessing you could get some rough edges when transitioning.
Any how, to try it, simply make the "ResetAxisFunctions" method public and call it after changing the "Axis" property on the core class. Let me know how it goes!
How to use Camera2D to create CameraBounds (on a camera that supports Pan and Zoom) with an Isometric View, of X=30º and Y=45º!
The camera view should not overcome the blue lines. How can I make this?
Hi @wagenheimer, a rotated camera (outside of predefined axes) is currently not supported. Most extensions will have their calculations wrong depending on how much your camera is rotated away from the defined axis. I'm planning to support it at a later stage but I currently have no timeline for it.
Hi! I'm in love with this asset and is just perfect.
I have two questions:
- Is there any way to have polygonal rooms for 2D, now rooms can only be square and that's fine for high column-like levels or corridor-like levels, but what happens if I have a big room that sometimes I need column-like sections and corridor sections. I'm developing a metroidvania. I've played several times the metroid games to understand how the camera works.
In the attached image you can see that that kind of room can't be achieved with rooms in Pro Camera 2D.
- Is there a way to know the actual size of the camera? I want the rooms to fit perfectly the size of the camera so in column like rooms the camera only moves in the Y axis and when I have corridor-like rooms the camera only moves in the X axis. Also this is useful because I use the camera as parameter of size for the minimap, so 3 squares wide in the minimap are 3 camera wide rooms.
Hopefully I explained it well enough.
At the moment that is not supported but I can look into it. Can you show me an example game that has this kind of rooms?
To know the camera size you can use:
Every metroidvania has those kind of rooms:
- Castlevania: Symphony of the Night -> The rooms that can't be done always are convex, and enveloping other rooms. They have a C or L shape most of the time.
In (1) there is even a room inside a room.
Well those are a few examples, it's not "hard" to do if there aren't any rooms on the convex empty spaces with Pro Camera 2D, but sometimes there are rooms in those spaces, and the idea is that you don't have to see inside another room.
Wow look at these rooms, some are insane:
Anyways, I think at least the first two examples could be achieved if it was possible to create polygonal rooms. Shadow complex ones are really complex, no pun intended.
Pro Camera 2D is one of our best bought assets from the Asset Store and I can't recommend it enough!
Thanks for sharing those examples. I'll have a look into this and see what's possible.
great Plugin! I have a little problem though. I need to change the zoom level of the PixelPerfect extension. The camera prefab is set at a zoom of 3. My script changes it to 2 with
ProCamera2D.Instance.GetComponent<ProCamera2DPixelPerfect>().Zoom = 2;
When I check the gameobject in editor it is in fact changed to 2, so that works. But for some reason the picture that the camera is showing is still the same as before. I need to push the controller on the gameobject manually to 3 and back to 2 for the camera to adapt the new zoom level. That doesn't seem right. What can I do? Thanks in advance.
@Urasawa1986 You're right. At the moment you need to call the "ResizeCameraToPixelPerfect" method after setting the zoom level through code. It's definitely not ideal and quite confusing so I'll make the change in the next release.
Could you add relative position for Rooms? I use them on separate game objects, so it would be nice to have this.
@TimNedvyga You got it! Just added it to the next release. Send me a PM with your invoice number in case you want earlier access.
Perfect! It worked. Thank you!
Hi, we've been attempting to get our game working on chromebooks, now that chromebooks have support for android apps. One problem that we've been having is that, the ProCamera2DPanAndZoom script only supports either touch OR mouse, chromebooks frequently have both (though so do many windows laptops nowadays).
I've manage to bodge a fix into your script (thanks for including those btw), but I think other people might see some benefit and it's a pain to maintain changes in external plugins. So if you could include a fix for this in an upcoming release it'd be a big help. I'd be happy to send you my changes if you want. Thanks!
@AlexNanomonx Today exactly I had another user requesting it! In the past 3 years never had that request. What a coincidence! =O If you could send me (through PM please) the changes you did that would be great.
@luispedrofonseca So I will probably be looking for a 2D camera system pretty soon and instead of building one, looking for a pre-made solution would probably be better and save a ton of time and PC2D looks pretty good. It know it already has a number of features I would want (transitions, parallax, pan / zoom, boundaries just to name a few) however there is one feature I want to ask about.
I am creating a side scrolling game and want to be able to create the effect of the game rotating on the axis that the user is not moving on (basically having one side the the screen appear to zoom in as the other side of the screen zoom out). It is hard for me to explain and probably not doing a great job at it, it is a similar effect the darkest dungeon does during combat:
Is this something that is possible out of the box with PC2D or if not, how hard do you think it would be to implement as an extension?
@ryanzec Something like that is not part of the package out-of-the-box because it goes into the realm of 3D movement. But you can easily accomplish it by parenting your camera and rotating it as needed. Just be aware that while the rotation is maintained the calculations that ProCamera2D does will be slightly offset because they won't take that rotation into consideration.
@luispedrofonseca is there a way to set a governor/limiter on the screen shake? We currently have an issue where if multiple events happen in a relatively short period of time, the shake calls stack and the screen can shake quite violently.
Is there was a way to set a max strength that will cap the combined strength of all shake events going on?
@markzorn At the moment there is not but I can look into it.
In the meantime you can try to call the "stop shake" method if you detect too many shake calls.
@luispedrofonseca Thanks for the response. We don't actually want to stop the shake just clamp it. If we have the time, might give a look at the source and see if there is an easy way to accomplish that.
Hi! Love your plugin design and am working on integrating it into what I have going... Quick question.. how do I get the camera to get under a 0.5f ortho?
my implementation requires a super close zoom in.... (microscope type game)
Great work! Hope I can get it to follow my super small characters...
@Skyboard_Studios There's a limit to prevent the camera to go below 0.1f to prevent some calculation issues, but there's nothing related to 0.5f that I can think of. How are you setting the camera size?
Anyhow, my recommendation would be to increase your "world" size, otherwise you might get some weird issues with physics and others related to float precision.
@luispedrofonseca after more playing... now my second session using the new camera system, I can say that it was my bad.... The first session was building toggle systems to disable my current camera system and let the procam system take over....Seems whatever my initial ortho size was set it. That value is the min. I had it set to a 0.5f and had my own zoom system adjusting it accordingly... I pre set it to a 0.2 and this allowed me to expand now up to 0.5 and beyond...
Bravo on your quick response and in making such a nice tool.
I am looking for the Targets count...
edit 2 days later: I can use the ProCamera2D.Instance.CameraTargets.Count
CameraTarget ct = ProCamera2D.Instance.GetCameraTarget(this.transform.root);
// if (ct) // ERROR
// if (ct.TargetTransform) //error
if (ct != null) //works
Debug.Log("Target Exists in ProCam Target List");
//Adjust Influences etc etc etc.
Debug.Log("Target is not in ProCam Target List");
//add to list so camera will track the next target...
just wondering what the elegent way of testing true/false if transform is in the target list or not.
@Skyboard_Studios That's the way to do it. Did you have any alternative in mind?
@luispedrofonseca I have faith that I I will get it working...
I need to get a nice workflow and initial camera state code setup so when the game starts the camera has lets say the spawn points in it's target list... so when the player joins the game the spawn spot(s) are removed from the target list and the players influences are established.... Check - All working now. I guess I could see what a 0 influence does.... if that is the same as removing it from the list all together.....
I see the "Pan And Zoom" is something I really would like to have a grip on as well... I have the pinch for zooming / unzooming working... just need to have another go at the Pan feature... then building the mechanics to turn on the ability to pan and then snap back to the player if all the "map panning" is done with... but not to make this a book.. but I see when I have the Pan And Zoom feature enabled this helper pan object (PC2DPanTarget) gets created in the target list....
was thinking perhaps on the "enabling" of the Pan/zoom feature so that at that moment the helper object should get poked into the targets list instead of at runtime.... still thinking about that behavior...
Requires the player to touch the game area to move. Check
Requires pinch to zoom/unzoom Check
Players movement near edge of screen causes camera to move. Check
When Start of game camera is in a non zoomed state... X
During Spawn camera will zoom in X
If During panning the "Pan" state is somehow enabled then I have to disallow the pan touches from moving player... Could be interesting...
I had to build a little system to keep the pan helper object at the same position as the player, as it is a influence of 1.0 as default. So the camera would snap to the freshly injected object.... .. lots to test and work out. Great work again. still learning. 3rd session is about to get going.
So perhaps that is why my pan isn't working.. I am forcing position changes on this object... should just be setting it to a zero influence I am thinking.
@Skyboard_Studios All the use-cases on your list are possible using the current API.
As for the zero influence objects, they are indeed ignored by calculations, so it might be easier to handle on your case.
I have some fears about performance using parallax system in pro-camera-2d. Parallax system is implemented by using multiple cameras (10-20 in my case). First of all it work just fine on my gtx960, but in unity frame debugger render target will be changed for each camera:
I am not 100% sure, but i suppose this unity-related render will be translated in OpenGL/DirectX API calls. So by the same amount of drawcalls for sprites (xor culling-masks), this method adds extra frame buffer (render target)-API-call switches for each layer. And FrameBuffer change seems to be really heavyweight GPU operation:
Moreover changing framebuffer is not only heavy, it also makes any batching between parallax layers not possible.
Are any performance issue with parallax cameras known?
What are limits for parallax layers, is 20 layers ok for mobile?
What is (approximately) performance difference to using more classical parallax system, where everything is rendered with 1 camera and objects are moved at runtime (not cameras).
One more problem, related to parallax: I have a problem using parallax and transitions extensions at same time. Transitions work well, but foreground levels are drawn OVER transition. That looks weired. I see some notes about GUI in TransitionFX docs about FX over GUI. Is it also the case for parallax?
@maltakereuz I understand your concerns and while I don't have enough knowledge of the render pipeline to exactly pinpoint the cost of those operations, I can tell you that from the tests I did the performance is great on mobile.
When I was first developing this extension I had an iPhone 5S, and from all the tests I did there wasn't any noticeable performance hit.
Now, I can't say this will hold true for all cases, so the best option is to always test and draw your own conclusions. I believe the performance hit will be neglectable in the majority of cases if you're using a sensible number of layers.
If you're using the TransitionsFX extension together with the Parallax extension, make sure the TransitionsFX extension is added to your foreground camera and not to the ProCamera2D, as is by default.
@luispedrofonseca Oh, sounds well. What was approximately amount of sprites in tests on iPhone S? In my case, i am not targeting mobile, but Nintendo Switch would be nice. Unfortunately i do not have nintendo switch just to test what overhead it could be 5%, 10%, 30%. But i hope it is <5%. Anyway sprite batching between layers have many other reasons to fail (different sprites, materials).
I could note 2 points, why multiple cameras are good:
1) static batching. objects can be marked static in inspector. (Actually parallax "premover" moves such static objects to match the camera pos. For ferr2d terrains it means they will not be rendered, but it's not the case for sprites).
2) It's pretty useful to apply effects to one camera only. For example blur background layers with slightly descendant strength.
And i found an old post about parallax performance, what could be a third point:
But i do not really understand what could be so wrong with moving 1000+ objects. Just to assign transform should be really cheap operation.
Back to the topic, so thank you for iPhone 5S test info. At least there is no known 30% problems or like that. May be i should not worring so much about performance, with 1000+ sprites on 300+ fps. But 15+ cameras in scene is very unusual setup.
P.S. I would like to vote up separate X/Y parallax moving one more time. Pretty easy to implement, but with quality level of pro-camera-2d it should work out of the box. It's is very useful for platformers. Common case: you want far object like mountains move slowly in X, but fast in Y to avoid strange unrealistic behavior.
upd: I think i am entirely wrong about switching Render Target for each camera/layer. Cameras with Depth probably render everything in same RenderTarget. Sorry for misleading questions then.
@maltakereuz I don't exactly how many sprites or layers I used. Like I said the best is to test it yourself using your own assets and values.
The problem with the majority of the other Parallax systems is that they force you to have a "ParallaxObject" script on each element you want to be part of the parallax layers. This can become quite cumbersome and performance-heavy if you're not careful.
In my opinion, the ProCamera2D Parallax system is a bit cleaner, easier to setup and (in most cases) should perform better.
@luispedrofonseca You are right: just tested 2000+ parallax sprites in your system and in self made primitive traditional sprite moving parallax system. Even with 10 cameras, your solution performs better. For some reasons moving 2000 objects is not letal, but significant amount of time. (200 -> 80 fps). Of course it could be optimized to move only visible objects, but anyway i see no problems to use 10+ cameras now.
Yes, attaching some marker-script to each parallax object is really annoying. However sync sorting layer and parallax_layer is pretty annoying too. Something could look wrong in editor, but right at runtime and vice versa. I will probably write some sort of checker script to ensure sorting layers of sprites are in sync with parallax layers.
Thank you for the quick response.
Hi, really great tool, but I have some small feedbacks here.
I'm using Unity 2018.2.14f1.
When I added new presets in Shake Extension, the inspector didn't know it's dirty, so did the main ProCamera2D component.
So I added some lines in the editor's script (Sorry I use image because It's more easy to show which line in the scripts)
Also, I preferred the color of the EXTENSIONS buttons on the ProCamera2D component can use similar color like the asset's logo. So I modified it too, hope you consider about it
@LuLuKo Thanks mate, those are great changes! Adding them to the next release.
@luispedrofonseca TriggerBoundaries are not multi-scene friendly! Because the editor code forces assignment of PC2D OnEnable, this forces a cross-scene reference to occur in edit mode, which causes console warnings to pop up all over the place. Everything still works fine in run time, but since I have tons of TriggerBoundaries, my console is just completely flooded with cross-scene reference warnings.
Easiest solution is maybe add a toggle to turn off automatic OnEnable PC2D assignment?
@arvzg I'll have a look at what I can do to improve the multi-scene support on the TriggerBoundaries. However, I should say that it's usually a better option to use the Rooms extension since it provides the same functionality while having a bit more options and flexibility.
Cool thanks! Looking forward to seeing what can be done. I did try just commenting out the ProCamera2DEditorHelper.AssignProCamera2D(target as BasePC2D); line in the editor code, but it doesn't fix it, looks like it'll be a little more complicated.
As for using Rooms, unfortunately that's also not the best solution for me. Originally I was using Rooms, but because I'm still in early stages of laying out my levels, the layout of the levels are changing constantly, and I find using TriggerBoundaries to be much more flexible in keeping each room much more self-contained
ProCamera2DEditorHelper.AssignProCamera2D(target as BasePC2D);
@arvzg Sure, if that works better for you, go for it. I just mentioned it because sometimes people don't notice all the extensions. I'll keep you posted.
@arvzg I was looking at the cross scene reference issue, and unfortunately it seems there's currently no way around those warnings. Unity will always throw those warnings. You can make a test by adding a cross scene reference on a basic script and you'll see it happening.
There's a setting that I thought would help, but even with it, the warnings are still thrown.
public class TogglePreventCrossSceneReferences
private static void Run()
EditorSceneManager.preventCrossSceneReferences = !EditorSceneManager.preventCrossSceneReferences;
Debug.Log("EditorSceneManager.preventCrossSceneReferences: " + EditorSceneManager.preventCrossSceneReferences);
@luispedrofonseca I did test that EditorSceneManager.preventCrossSceneReferences myself earlier and yeah got the same results. Cross scene references are allowed, but the warnings are still there.
For the time being, since I'm using Editor Console Pro, I can simply filter out those specific warnings and ignore them for now - but do you have any long term plans to better support this in future?
@arvzg Not at the moment, but I can look into it. I'm open to suggestions though.
@luispedrofonseca Well, after a week or so... I have managed to get the camera system integrated fairly well. Bravo again. Your asset has made things so much more compact and concise but still just have a few things to wrap my head around.... One being the pan system... I would love to get it working... I have yet to have it working in the editor or during runtime. Should I enable the pan feature through code during runtime when I think the "Pan" should be enabled. And then "Disable" it when done.... vs having it already enabled during editor design time and then working with the pan object that is created...
update 5 min later: Wow. I am blown away on how well the demo works for the pan / zoom extension. Like no problems at all... Perhaps it is the fact that I am using the EasyTouch plugin and it has many it's fingers in there too. I will keep digging.
Was thinking that perhaps the "Pan" and Zoom" feature should be separated features....
Ding* Ding* Feature Request Ding* Ding*
How about a feature where a "fast + long pinch" would zoom in/out to a set level......
So imagine instead of this continual gradual constant need to keep pinching and pinching to get to the zoom level desired... ...the player could have a auto gradual zoom in/out pinch. Where if the pinch lasts longer than a set time then it will "auto" zoom in the direction that you were pinching....
Still lots to say about things.. but I will keep going and see what I can come up with...
@Skyboard_Studios Glad you figured it out. As for your feature request, I don't think it's a very common use case, so it's one of those features you'll have to write your own ProCamera2D extension. It's really straightforward, on your case you probably want to start by duplicating the PanAndZoom extension and go from there.
Well my suggestion is still simply have an option to turn off the automatic editor assignment of the camera in edit mode, maybe as an option in the preferences window instead of on the component itself.
I don't really see any real need for having the camera be assigned in edit mode instead of in awake/start in play mode, but I could be wrong
Also I'm thinking of a hack in the meantime to get around the warnings by 'wrapping' the Trigger Boundaries around my own class which creates the Trigger Boundary in runtime in Awake/Start, after the multi-scenes have loaded
@arvzg The assignment happens because some extensions/triggers need the reference to the ProCamera2D core component during edit mode. And that happens on the base class that they all share.
Hey, great asset! I have a question about the Zoom function on the camera instance.
Whenever I use this function it seems to not work, is this function intended to zoom the camera or is there an alternative function I can use to change the zoom/size of the camera? Thanks in advance!