How to Remove Back Button in Unity Cardboard SDK - unity3d

Anyone have an idea of how I can remove the white back arrow that is rendered in the top left of the screen by default. Google is not turning anything up and the only thing I can find in the newest unitypackage is a call to DrawBackButton() in GvrPostRender under the legacy stuff.
Thanks!

I don't think this is possible right now. I have tried to do this, and while searching in sdk i found this in GvrPostRender:
if (vrMode) {
DrawVRBackButton();
}
but then I checke this function and it looks like this:
private void DrawVRBackButton() {
}
I aleso tried to simply remove this function from if(vrMode), but this didn't work as well, so I guess we have to use it until they make it possible to turn off.

Related

How do you automatically focus on an inputfield when opening/activating the UI in Unity3d?

I am making a game where you must open or activate the UI with the space bar. Now, this works perfectly fine, but it is pretty annoying that every time you open the UI you must click on the inputfield to write in it. Is there any way around this? So is there a way to open or activate the UI without having to click on the field to be able to write in it?
I looked for YouTube videos and tried to find similar problems in other forums, but wasn't able to find a script, nor was I able to find some Unity settings to do so.
You could use e.g.
private class SelectOnEnable : MonoBehaviour
{
private void OnEnable()
{
EventSystem.current.SetSelectedGameObject(null);
EventSystem.current.SetSelectedGameObject(gameObject);
}
}
and attach it to whatever object that should become the selected one everytime it is enabled. See EventSystem.SetSelectedGameObject
Can't test it right now but it might still require the User to hit Enter in order to also actually set the Input field into edit mode. The upper line only sets it as selected UI element (similar to using TAB in a browser).
Otherwise I think you would go through
yourInputField.DeactivateInputField()
yourInputField.ActivateInputField();
to directly set it active. See InputField.ActivateInputField. Might have to do both in combination - again can't test right now ;)
Thank you very much, derHugo! Everything works like a charm now! You saved me a lot of time. Referring to your last comment, I used both of them, and it seems to work very well for me. Here is the code I used:
`private void OnEnable()
{
EventSystem.current.SetSelectedGameObject(gameObject);
GameManager.GetComponent().inputFieldInMainUi.ActivateInputField();
EventSystem.current.SetSelectedGameObject(null);
GameManager.GetComponent<InputFieldComparision>().inputFieldInMainUi.DeactivateInputField();
}`

LWUIT menuBar refreshTheme not working?

I'd like to dynamically change the text of a Command depending on some state, so normally I went to Google and LWUIT blogs said that using refreshTheme() on MenuBar should do the trick.
So I used the following code, but it sadly didn't work
if (isPlaying) {
playButton.setCommandName("Pause");
}else{
playButton.setCommandName("Play");
}
this.getMenuBar().refreshTheme();
Is there something wrong with my code? Or did I misunderstand something?
It won't refresh. The text of the button is set when the command is placed so you can't do that.
You will need to use removeCommand(cmd) followed by addCommand(newCmd).
Furthermore, refreshTheme() has absolutely nothing to do with anything.

CCScrollView not swallowing touches in cocos2dx

I'm using a CCScrollView in a pop-up tab which overlaps some existing controls on the screen. The problem is that although the CCScrollView is responding correctly to touches, the touches are not being swallowed, so that the controls underneath it respond to them also.
I verified that the control is registering itself as a targeted delegate with the TouchDispatcher and I actually put a breakpoint on the "return true" in CCScrollView::ccTouchBegan and watched it hit it, but the touches were still passed to the controls underneath also.
I couldn't find much on this on SO, but I found that someone had this problem some time ago in the regular cocos2d:
http://www.cocos2d-iphone.org/forums/topic/making-ccscrollview-swallow-touches-but-still-scroll/
unfortunately the only answer there didn't help.
I feel like I must be missing something simple but I'm just about at my wit's end. Any advice on what I'm doing wrong?
I came back to the problem after a break and after some renewed frustration I found that CCScrollView actually really wants this behavior. From lines 133-136 of CCScrollView.cpp:
void CCScrollView::registerWithTouchDispatcher()
{
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, CCLayer::getTouchPriority(), false);
}
That false at the end is of course the culprit.
I am completely in the dark why anyone would want this as the default behavior, but at least my code works now.
MyLayer::MyLayer()
{
CCWidgetLayout* widgetLayout = CCWidgetLayout::create();
addChild(widgetLayout);
CCScroll* scroll= = CCScroll::create(CCSize(480,800));
scroll->setPosition(ccp(480,800));
scroll->setScrollSelector(this, scroll_selector(MyLayer::onScrolling));
scroll->setDirection(eScrollDirectionVertical);
widgetLayout->addChild(scroll);
sprite = CCSprite::create("scrollcontent.png");
scroll->setContainerSize(sprite->getContentSize());
scroll->getContainer()->addChild(sprite);
}

Dragging and dropping something onto an xna window?

I have an XNA4 wndow set up and was wondering if I could get it to accept drag+drop actions, what I envision is someone grabs a jpeg and drags it into the window, upon release of the mouse an event is fired off with a string pointing to the jpeg.
Is this doable and if so how?
First, here is a link to a tutorial on doing this with a windows form:
http://support.microsoft.com/kb/307966
and here is a link to a post about doing just this (answer is past a few posts saying that it's impossible):
http://forums.create.msdn.com/forums/p/4020/20419.aspx
finally here is some code for ease of access (you need a reference to the System.Windows.Forms namespace):
protected override void Initialize()
{
Form gameForm = (Form)Form.FromHandle(Window.Handle);
gameForm.AllowDrop = true;
gameForm.DragEnter += new DragEventHandler(gameForm_DragEnter);
gameForm.DragDrop += new DragEventHandler(gameForm_DragDrop);
}
Also, it seems it's possible to run a game inside a Form control as of XNA 2
While I recognise that this is many years too late here is a direct link to a working demo.
The SLN might not want to autoload but you can just drop it into VS2013 and it will update it. I was getting a "licencing" popup when I tried to just run the SLN.
Hope this helps anyone who might still be working on this.
http://geekswithblogs.net/mikebmcl/archive/2011/03/27/drag-and-drop-in-a-windows-xna-game.aspx

disable back button on in ltk wizardinputpage

I'm doing a plugin in Eclipse IDE in order to do a refactoring. I'm using LTK, the point is: I don't know how I can disabled the back button after the preview. I've tried to create the RefactoringWizard using some flags like 'NO_BACK_BUTTON_ON_STATUS_DIALOG', but I think it is not the rigth way to do it.
The poblem I have in the background is that when I push preview and then push back, and preview again, the preview box shows the change related with the refactoring twice!.
I think the best solution is disabling the back button after the preview because this is the solution I have seen in others plugins.
Sorry because of my English and thanks beforehand.
The method org.eclipse.jface.wizard.WizardDialog#updateButtons disables the back button when currentPage.getPreviousPage() returns null. So, I suggest you to override the method org.eclipse.ltk.ui.refactoring.RefactoringWizard#getPreviousPage to return null.