Hello,
I am new to Adventure Creator, and have decided to use it to help simplify making a point and click game for a class. I like it a lot so far, the manual has been helpful as well as similar posts in this forum but I still can't seem to fix an issue I've been facing. My classmates have no experience in programming while I have only enough experience in C# to get by, I certainly wouldn't call myself a programmer. The issue I've been having has to do with integrating a third-party minigame into a 2D Adventure creator game.
This game is a simple slide puzzle I got off of the asset store for free, at runtime it uses a script to create the puzzle. I followed https://adventurecreator.org/tutorials/creating-inventory-bar-unity-ui to create a menu with a Unity UI prefab source. When the menu is turned on, it creates the prefab canvas and panel, which contains the slide puzzle prefab asset inside of it. Here are my Menu properties, which I tried to match to the instructions. (it says missing RectTransform but from my understanding it uses the ConstantID to create the RectTransform when the menu is turned on, and the ConstantID matches that of the panel inside the prefab canvas)
Despite following this tutorial, when I turn on the menu during runtime, it still appears to be much larger than the screen and as such the puzzle isn't visible in game mode.
Here is the Game screen while playing, I can tell the menu is at least visible since I can see the panel's semi-transparent image component is overlayed on top of the scene
https://imgur.com/a/o1SOFhX
However, here's the Scene screen while playing. The little dots in the left are the gameobjects that are rendered by my camera, to give an idea of the scale difference between what is onscreen in game and the size of the canvas.
https://imgur.com/a/dgAqi8K
Back in the Menu properties, I see this instruction to assign a RectTransform boundary, which I did, but then it says to call Menu.SetCentre to reposition the Menu. That second bit isn't mentioned in the tutorial so I'm not sure if that is the reason behind this issue.
I am using a 2D Drag Camera if that information helps. Here is the inspector view of my canvas prefab as well.
Any help would be much appreciated, thank you!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @audreyq.
What's the puzzle asset you're using?
If I'm understanding right, you're using AC's Menu system here purely as a means to show/hide the puzzle. Is this because the puzzle itself uses Unity UI, or because you want to be able to control its visibility with AC?
The large scale of the UI in the Scene window is due to the Canvas component's "Screen Space - Overlay" option. This shouldn't typically be an issue. If the UI itself is fixed in size and position, you can uncheck "Always fit within screen?".
I'd suggest first getting the puzzle to appear correctly in the scene without involving AC. If you lock/delete your Menu, then drop the UI Canvas prefab directly into the scene file, it should then just render as normal without AC affecting it. Does it then show up as intended in the Game window?
Thank you for the quick response! I am using https://assetstore.unity.com/packages/templates/packs/sliding-tile-puzzle-game-41798 which doesn't have any documentation on it due to link rot but is easy enough to understand by looking at the code to see how the puzzle is created (plus it's free).
I tried just dropping the prefab of the slide puzzle into the scene like you suggested and it does successfully show up, properly sized, it just is not visible behind all of the sprites and background objects.
The workaround for this would be to just turn off the visibility of those objects in the Actionlist that enables the puzzle so that it is the only thing on camera. The only problem is if I did that I don't know if I'd be able to put any nice backgrounds behind the slide puzzle since I don't know how to apply any Sorting Order to its Gameobject.
Here is the inspector view of the instance of the prefab I dropped into the scene.
https://imgur.com/a/SyxXzWk
Would adding ACs Follow SortingMap script work? The puzzle not an object that uses a Sprite Renderer so I am not sure.
At this point I think this is me having an issue with Unity's way of setting render order since the puzzle is built out of tiles that are actually using a mesh renderer component but I do want to check if there is an AC feature that would help me do this
Thanks for the details. I've had a look at the asset, and yes - it's a case of needing to mix Sprite and Mesh Renderers together.
AC generally relies on Unity for rendering duties, and the Sorting Map is now recommended primarily to scale characters by their position - with actual sorting based on Unity's own Transparency Sort Axis value.
In my own test scene, though, it seems to just need the scene sprites to be physically behind the puzzle for them to be drawn underneath. Try setting the ST_Puzzle Display component's Puzzle Position Z value to -1, which will bring it forward towards the camera.
Once things render correctly, you'll want to spawn the puzzle in as a prefab using the Object: Add or remove Action - as opposed to linking it to a Menu.