I am attempting to switch screens but it can't, I have browsed multiple forums and none of the solutions have worked. The code I am using is:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class GameMaster : MonoBehaviour
{
public void GoToGameScene()
{
//Application.LoadLevel(1);
SceneManager.LoadScene(1);
}
}
This is my "GameMasterScript" which is attached to my canvas that my button is under, I have also tried attaching it to the main camera but that doesn't seem to work as well.
The following are screenshots of my canvas, button, and my build settings.
This issue I ran into here was dragging an image and adding a button component to it, which made it not work. Simply adding a button to the canvas UI then putting the image on the button allowed it to work properly
Related
I'm absolute beginner in UrhoSharp. I only wanted to implement some basic 3D stuff into my app. Everything works fine with SimpleApplication, the screen is supposed to be watched from one place and direction. When I touch the screen, the scene rotates however. How can I get rid of this behavior?
I wanted to try to override some function of SimpleApplication (probably OnUpdate) so I came with name CursedApplication replacing SimpleApplication everywhere. When I use
using CursedApplication = Urho.SimpleApplication;
everything still works. But what I supposed to be the equivalent
class CursedApplication : Urho.SimpleApplication
{
CursedApplication(ApplicationOptions options) : base(options)
{
}
}
breaks the application. Some idea how can I make things work? Or do I have to build my own scene logic without SimpleApplication?
Finally I found that this can be done with
app.Input.Enabled=false;
where app is instance of SimpleApplication.
Description
I have this strange behaivor using NavigationService with my MasterDetail on iOS.
When I click the option in the menu calls a command from the ViewModel
private async void OnNavigateCommandExecuted(string path)
{
//await NavigationService.NavigateAsync(path);
await NavigationService.NavigateAsync("Navigation/ReadCodeInstructionPage"); //For example
}
There is a slight delay when the transition is made between the pages, and back button appears and then disappears.
On Android works perfectly.
Am I doing something wrong or is a bug?
Example
I'm looking to track how long a person looks at an object in Unity when using Google Cardboard (building for iOS).
I'm not sure how to go about this. Would it be the same as mouse tracking?
Any direction would be greatly appreciated!
On each update, use a raycast from the position of the camera to determine what (if any) object is directly in front of the camera. Whenever this object changes, calculate the time difference.
Considering that you have already setup GvrReticlePointer and GvrViewerMain prefabs into your scene-
Create a script and add it to the GameObject from the inspector window.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class TimeCounter: MonoBehaviour
{
public float timer;
void Update ()
{
timer += Time.deltaTime;
}
}
Hit play and gaze towards the game object. You would find the Timer value in the inspector getting changed. You could also customize the above script and modify to your need.
I have created a game in Unity and am deploying to an iPhone by building the project for Xcode and going from there. Unity wraps its projects up and generates the objective-C files in Xcode for you;
I have worked with Swift in the past and have always delayed my launch screens (I know this is bad practice but I am working with someone who would like the splash screen displayed for 3 seconds before the game instead just appearing briefly) by having the application sleep for a few seconds in the applicationDidFinishLaunching method. I need to know how to do this with a Unity project generated with objective-c-
I have tried putting [NSThread sleepForTimeInterval:6.0]; in the
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
function in my UnityAppController.mm file, and while this seems to be the right place the splash screen is still displayed for maybe a second.
How can I delay the splash in a unity project in Xcode?
Actually you can implement this request in the Unity itself.
Create a 2D canvas in your first scene, and make it over everything else like this:
Render Mode: Screen Space - Overlay
Change your splash screen image texture type to Sprite like this
Texture Type: Sprite (2D and UI)
Create an UI Image and assign above sprite as Source Image to cover all screen
Source Image: SplashScreenImage
Create a start script component into canvas object like this one
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class CanvasBehaviour : MonoBehaviour
{
public Image backgroundImage;
void Awake() {
StartCoroutine(RemoveBackgroundImage());
}
private IEnumerator RemoveBackgroundImage()
{
Debug.Log("Before Waiting 3 seconds");
yield return new WaitForSeconds(3);
backgroundImage.gameObject.SetActive(false);
Destroy(backgroundImage);
}
}
By doing this, after splash screen, user will only see the same image so he/she will not understand that anything changed.
Since you don't block the UI Thread by making sleep, you can show some basic animation in the canvas and/or prepare your scene behind the background image.
I'm pretty new to MonoTouch and I'm having problems getting my app to rotate from portrait to landscape mode.
My project has two XIB files, the MainWindow added by MonoTouch and MainController.xib which I have added. The MainController has a single label and no other controls. In my Main.cs I have the following to load the MainController.xib file:
UIViewController controller = new MainController();
window.AddSubview(controller.View);
In the MainController code I added
public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
{
return false;
}
It all runs fine and the label displays but when I rotate the simulator nothing rotates. I'm sure it's something really simple that I'm getting wrong but I just can't seem to crack it.
Any help would be appreciated.
You can look at TweetStation for a sample.
In this particular case, you might want to return "true" instead of false in the sample above.