Basic things.

fukada

New member
I am translating Japanese.

I ask my question knowing my ignorance.
It may be commonplace, but I can't even find an explanation.

I am creating a UI for smartphones.
Touch the shop object Colander and press the virtual button to open the shop menu.
Please tell us about the specific design method.

I tried various things for several days, but it did not develop.
 
Correct me if I misunderstood.

You want to move the character close to the shop interactable, and then press the Interact button on a virutal input (Option 1)?
Or do you want to press directly on the shop collider to open the shop menu (Option 2)?


Option 1:
Check out the demo scene and look how the character and shopMenu are setup.
1) On you character ensure you have an Inventory Interactor, a Rigidbody and a CharacterController or a Collider. Ensure your Layer is set to "Character" or something specific
2) Make sure your virtual control presses the same action as the one specified on the Inventory Interactable:
1693211209934.png
3) Setup the ShopMenu exactly like the Demo scene with an Interactable component and a MenuInteractableBehaviour.
Ensure the ShopCollider is set to Trigger. and that the Interactable Layer mask includes the player cahracter layer



Option 2:
Create a custom script that calls the Open(myInventory) function on the ShopMenuOpener component.
 

Attachments

  • 1693210985872.png
    1693210985872.png
    57.5 KB · Views: 4
thank you for your reply. I am glad that you responded.
This is the case for Option 1.

I would like to open the shop menu when I press the button on the screen on my smartphone.
I'm not sure how to register the virtual button.
Set "input type" to "button down".
If the "input name" is "action", how to set the virtual button to "action"?
I don't know how to assign virtual buttons.
"charactercontroller" cannot be used because the character is moved by "rigibody".

Sorry for my ignorance.

Could you please reply?
Could you please answer me?
 
Last edited:
Since there was no response, I realized that I was probably listening to something stupid.
Maybe it's not worth answering...

In the input manager, I created "Talk" and set the T key.
With this, the conversation will start with the T key on the keyboard,
I want to start a conversation with a virtual button on my smartphone.

How can I start a conversation with a virtual button on my smartphone?


What you need when opening "shopmenu".

>player
inventory interactor

>shopmenu
shop menu
UI

>shop object
collider (trigger)
shop menu opener
interactable
inventory
menu interactable behavior

It would be good to have an explanation of what is required at a minimum and what role each one plays.


public class TalkButton : MonoBehaviour
{
public void Talk()
{
SendMessage("Talk", SendMessageOptions.DontRequireReceiver);
}
}
 
Last edited:
Sorry I don't know why I wasn't notified about your second message.

Also I'm currently on Holiday so reponses are slower than usual.

What virtual button system are you using? Is it a third party asset or something you made yourself?

In any case, you'll need a custom script. When press the virtual button you will need to find the ShopMenuOpener component. If you only have one then that's easy, just reference it in a serialized or public field in your custom scriot. Then simply do
myShopMenuOpener.Open();

If you have multiple ShopMenuOpener then you'll needto find the one youare close to.
You can probably do so by searching in the list of interactables within the InventoryInteractor componenet


If you still struggle with this after a week let me know and I will write you some code when I get back from my holiday, maybe I'll make a feeature scene about it
 
Top