Hello there AC'ers.
I posted another thread about a decoration game I want to make.
I have gotten a little wiser and therefore would like to ask a technical questions.
If I, say have a default chair in my scene and when I click the inventory item of another chair and it's set with action to be object: visible - how would I then "hide" the chair that is in the scene already? The chair will change, ie if the new was selected - and then if another one i selected that will be swapped etc. So it's never a "fixed" chair that it is in the scene.
Not sure how to accomplish that?
Would appreciate any direction
Best regards and Happy Easter
Cheers, Dan
Comments
If I teleport, how will I know what item is 'active' in the scene and can 'hide' that?
(I'm not sure how I know what is currently 'the chair that is in the scene, how I 'detect' that, so I can hide it when. It might be objects from varies inventories (to mimick 'tapped' categories) and whenever an object is tapped in the inventory, it should appear at a fixed position, hiding the one that is already there.
If I have, say 1000 items, will the scene be very heavy mobile?
You could, for example, create an ActionList that hides all chair sprites in your scene and then re-shows just one of them - and that one is set dynamically with a GameObject parameter. Have a look at that tutorial and see if that's relevent for your situation.
GameObject[] gameObjectArray = GameObject.FindGameObjectsWithTag (“Hair”);
foreach (GameObject go in gameObjectArray) {
go.SetActive (true);
}
(I have NO idea why the CSS is added below - it's not here in my post! Sorry for that)
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
li.li2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 16.0px; font: 13.0px Courier; color: #323333; -webkit-text-stroke: #323333}
span.s1 {font-kerning: none; color: #2c91af; -webkit-text-stroke: 0px #2c91af}
span.s2 {font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000}
span.s3 {font-kerning: none}
span.s4 {font-kerning: none; color: #018000; -webkit-text-stroke: 0px #018000}
span.s5 {font-kerning: none; color: #813500; -webkit-text-stroke: 0px #813500}
span.s6 {font-kerning: none; color: #a31516; -webkit-text-stroke: 0px #a31516}
span.s7 {font-kerning: none; color: #008de4; -webkit-text-stroke: 0px #008de4}
ol.ol1 {list-style-type: decimal}
p.p1 {margin: 0.0px 0.0px 0.0px 36.0px; text-indent: -36.0px; line-height: 16.0px; font: 13.0px Courier; color: #813500; -webkit-text-stroke: #813500}
span.s1 {font-kerning: none; color: #2c91af; -webkit-text-stroke: 0px #2c91af}
span.s2 {font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000}
span.s3 {font-kerning: none; color: #323333; -webkit-text-stroke: 0px #323333}
span.s4 {font-kerning: none; color: #018000; -webkit-text-stroke: 0px #018000}
span.s5 {font-kerning: none; color: #813500; -webkit-text-stroke: 0px #813500}
span.s6 {font-kerning: none; color: #a31516; -webkit-text-stroke: 0px #a31516}
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
li.li2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 16.0px; font: 13.0px Courier; color: #323333; -webkit-text-stroke: #323333}
span.s1 {font-kerning: none; color: #2c91af; -webkit-text-stroke: 0px #2c91af}
span.s2 {font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000}
span.s3 {font-kerning: none}
span.s4 {font-kerning: none; color: #018000; -webkit-text-stroke: 0px #018000}
span.s5 {font-kerning: none; color: #813500; -webkit-text-stroke: 0px #813500}
span.s6 {font-kerning: none; color: #a31516; -webkit-text-stroke: 0px #a31516}
span.s7 {font-kerning: none; color: #008de4; -webkit-text-stroke: 0px #008de4}
ol.ol1 {list-style-type: decimal}
go.transform.position = new Vector3 (0f, -1000f, 0f);
That can be done regardless of however you show the "correct" object.
So far as using parameters goes, I was thinking you'd only need one or two. You could refer to GameObjects by Constand ID - just attach a Constant ID component to an object, and it'll be assigned an ID number that is unique to it in that scene.
You can then enter that number in as a GameObject parameter's value when using the ActionList: Run Action.
Alternatively, you could just script the whole thing. These are Hotspot inventory interactions, correct? You can set the Hotspot's Interation source field to Custom Script, which allows you to run custom script functions instead of ActionLists. If the function that is used for inventory interactions has an integer parameter, that parameter will be set to the ID number of the inventory item - allowing you to script an appropriate reaction accordingly.
It seems to me that this would also work with Character Customization as-well, ie hair, clothes etc, even when the character is animated, since all gameobjects are parented to the character, where as the teleport seems to work only on static positions.
If your Interaction method is set to Choose Hotspot Then Interaction / Choose Interaction Then Hotspot, then you can check Single 'Use' Interaction? in the Hotspot Inspector to emulate Context Sensitive mode on a per-Hotspot basis.
Otherwise, you can use the Menu: Change state Action to lock / unlock your Inventory menu from appearing even when its Appear type rule is met. These can be placed in ActionLists triggered by the Hotspot's "Highlight object" events if need be, but it could also be scripted.
Regarding the flashing issue, know that you can check the game's current state by checking List active ActionLists in Game window? at the bottom of the Settings Manager. Also, be sure to use the latest version of AC (backing up your project first). Which buttons are flashing, and what was the Appear type of the Menu when not Manual?
In regards to the flashing issues of the buttons, it was due to the fact that you mentioned that it needs to run in background and not "during gameplay". You also mentioned the appear type should be set to manual. My buttons disappear from the screen when I do that - so I guess I have missed out on something?
I have several hotspots where I use that method on, one is a camera panorama of the world, and it works perfectly, revealing the scene and then goes back to to gameplay. No menus or nothing.
Then I have an object the player can tap and a particle effect will play. But here the menu appear!
I don't understand that, since both a done with with the use interaction and have single use interaction, so they should be similar. Not sure why.
Is there a way to get around it?
It's a joy to work with - and thanks for all the amazing help!
In this thread, I suggested restyling the Interaction Menu to look like the "bottom" one. How did that go?
I feel that at this point we're more bogged down with issues related to the way things are set up in the game, without addressing what it is exactly you want. If you would like to instead explain the gameplay you're wanting to achieve, it may be easier to cover the steps to achieve that instead.
However, if you want your Inventory menu to appear when clicking on a Hotspot - and for clicking those items to instantly "use" them on that Hotspot, then your InventoryBox element must be placed in a Menu with an Appear type of On Interaction, and the Inventory box type field must be set to Hotspot Based. These settings will cause the following:
1) The Menu to appear when a Hotspot is clicked (provided that Single 'Use' interaction is unchecked)
2) Clicking items in the Menu will automatically use them on the Hotspot.
It shouldn't be the case that any Menus with a different "Appear type" should show, and this behaviour is basically the same as the 2D Demo. The 2D Demo, however, allows you to also "Use", "Talk", and "Look At" Hotspots in the scene, and this is because the Interaction menu contains Interaction elements for each of these icons alongside the InventoryBox (as you've seen).
Removing these interaction elements from the default Interaction menu will cause only inventory items to show, and you can restyle it so that it sits along the bottom.
You will, however, have to amend your Close interactions with setting to Click Off Hotspot so that the Menu doesn't close when the mouse leaves the Hotspot to reach the Inventory menu. Or, as I mentioned in the other thread, make the Menu cover the whole screen (but invisibly) so that the mouse/cursor/tap technically never leaves it.
Regarding the menus appearing when the particle system plays, please post this in a separate thread showing screenshots of the Hotspot Inspector, the ActionList, the properties of the Menu which shows, and anything else that might be relevant. It may be there's some minor difference with those that work which has been overlooked.
So far as the flickering goes, which Menu are you talking about? When I suggested turning it to Manual, I was referring to the "InGame" menu - not the one that shows the Inventory. The "InGame" menu is the one in the lower-left corner to open up the Pause menu. This, too, can be restyled to suit.
For the "floating" character, check that the character's model/rig child objects have (0,0,0) positions so that they are at the centre of the root object. This may be an animation issue instead - sometimes when importing animations, Unity will adjust the Y position - particularly if it uses root motion. You can prevent this by going to the animation import settings when viewing the animation/model file's Inspector - but if this is the case, then it's a Unity issue rather than an AC one.
Re: controlling the camera - AC also has a "GameCamera 2D Drag" prefab available for 2D games, which allows for dragging the view around. Though you're working in 3D, it may still work for you - try dropping it into your scene (it's in Assets/AdventureCreator/Prefabs/Camera). Note that using it in v1.58 currently shows an error, though this will be fixed in the next release. Otherwise, you can rely on a custom camera script that behaves the way you like. Incorporating custom camera types into AC is covered in the Manual - section 4.2.7.