Menu
  • HOME
  • TAGS

Google Play game services | ShowSelectSavedGameUI Unity android

Tag: unity3d,google-play-services,android-savedstate

I am getting following exception on showing saved game ui.Here is my code:

PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
            .EnableSavedGames()
                .Build();
        PlayGamesPlatform.InitializeInstance(config);

        // Activate the Play Games platform. This will make it the default
        // implementation of Social.Active
        PlayGamesPlatform.Activate();

        // Sign in to Google Play Games
        mAuthenticating = true;
        Social.localUser.Authenticate((bool success) => {
            mAuthenticating = false;
            if (success) {
                Debug.Log("Login successful!");
            } else {
                // no need to show error message (error messages are shown automatically
                // by plugin)
                Debug.LogWarning("Failed to sign in with Google Play Games.");
            }
        });

show UI code ::

((PlayGamesPlatform)Social.Active).SavedGame.ShowSelectSavedGameUI("Save game progress",                                                                       1,true,false,SavedGameSelected);

NotImplementedException: You must enable saved games before it can be used. See PlayGamesClientConfiguration.Builder.EnableSavedGames. 02-06 20:03:38.804: I/Unity(32369): at GooglePlayGames.Native.UnsupportedSavedGamesClient.ShowSelectSavedGameUI (System.String uiTitle, UInt32 maxDisplayedSavedGames, Boolean showCreateSaveUI, Boolean showDeleteSaveUI, System.Action`2 callback) [0x00000] in :0 02-06 20:03:38.804: I/Unity(32369): at GameManager.ShowSelectGame () [0x00000] in :0

However each time i am getting success from login.

Best How To :

This problem got solved by breaking this into two parts, On game start call Activate platform. And then call for login.

GC overhead limit exceeded with google play services

android,google-play-services

I would suggest using android studio instead of eclipse https://developer.android.com/sdk/index.html. But also, you could try launching eclipse with more memory: How can I give eclipse more memory than 512M?...

ant jar error: Execute failed: java.io.IOException: Cannot run program…${aapt}": error=2, No such file or directory

java,android,osx,unity3d,jar

Have you updated the Android SDK tools to 24.3.2? This seems to have caused the issue. Add following 4 lines to android-sdk-path/tools/ant/build.xml starting line 484 and hopefully it should solve. <property name="aidl" location="${android.build.tools.dir}/aidl${exe}" /> <property name="aapt" location="${android.build.tools.dir}/aapt${exe}" /> <property name="dx" location="${android.build.tools.dir}/dx${bat}" /> <property name="zipalign" location="${android.build.tools.dir}/zipalign${exe}" /> ...

Iterating through multiple levels of Child Objects

c#,unity3d,iterator

The way you wrote it is actually exactly how you want to do it. The method is called recursion. It is a very popular way of achieving what you are trying to do, nothing wrong with having a method calling itself, if done within certain guidelines like meeting certain criteria...

In Unity3D, How to make the whole scene in dark, but some Area are not in dark

unity3d

I'll explain how you can achieve this with a simple shader and some setup. I'm speaking from memory so if some problems occur please ask. So what you can do is: Make a new layer for rendering the masks. Let's say we call this layer MaskLayer. Duplicate your main camera....

converting string to vector in Unity

vector,unity3d,unityscript

I figure someone else might find this useful later so: if(PlayerPrefs.GetFloat("nodeNum") > 0) { //Assemble axis value arrays //X var xString = PlayerPrefs.GetString("xVals"); var xValues = xString.Split(","[0]); //Y var yString = PlayerPrefs.GetString("yVals"); var yValues = yString.Split(","[0]); //Z var zString = PlayerPrefs.GetString("zVals"); var zValues = zString.Split(","[0]); var countNode = 0; var...

Giving objects unique ids onStart

c#,random,unity3d

Unity already provide an unique id for every object instance, have a look at GetInstanceID.

AdColony's OnVideoFinished not call in Android

c#,android,unity3d,adcolony

This is a known issue at AdColony and we will be releasing a fix in a pending release. We will update this post once it has been released at: https://github.com/AdColony/AdColony-Unity-SDK...

Android studio can not resolve com.google.android.gms.location.places.AutocompleteFilter

android,android-studio,google-play-services,google-places-api

The Places API was only added in Google Play services 7.0: you'll need to update your dependency to be at least 7.0.0, although the latest as of this answer is 7.5.0. Note in almost every case, you should use selective APIs to only include the portions of Google Play services...

Unity3D Bullet Tracers

unity3d,unityscript,raycasting

Quaternion.LookRotation((fwd - transform.position).normalized) needs to be Quaternion.LookRotation(fwd.normalized)

Make two physics objects not collide but do detect collisions in Unity

unity3d,2d,physics

Yes, you need to create a child GameObject, with a trigger collider, and put it in a layer that interacts with the player layer. No, you don't need to add a Rigidbody to the new GameObject, the parent's rigidbody already makes it a dynamic collider, so you will get OnTrigger...

Unity An object reference is required to access non-static member C#

c#,unity3d

You need to instantiate your class Rigidbody before accessing a non-static field such as AddForce. From the documentation bellow : using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { public float thrust; public Rigidbody rb; void Start() { // Get the instance here and stores it as a class...

Scoring scale object

unity3d

this is very simple. use one image as the scale background. use another image as the pointer. set the pivot and anchor of the pointer at the position where you want to rotate it. use transform.Rotate() in your code to rotate the pointer.

How to specify google play services dependency in maven

android,maven,google-play-services

From Google-Developers: In versions of Google Play services prior to 6.5, you had to compile the entire package of APIs into your app. In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code)...

Unity procedural TileMap generation without creating gameobject per tile

unity3d

Given the sole task of "creating an efficient tilemap", your best option is to create a TileMap component that manages a procedural mesh made up of a collection of independent quads with uvs mapped to a tile atlas. This way you will even draw your whole map in one drawcall....

Loading MP3 files at runtime in unity

c#,unity3d

As noted above, windows doesn't support MP3, so use OGG or WAV. You must wait for WWW to complete before accessing the clip. And WWW must be loaded in an asynchronouse Coroutine. public void LoadSong() { StartCoroutine(LoadSongCoroutine()); } IEnumerator LoadSongCoroutine() { string url = string.Format("file://{0}", path); WWW www = new...

Turning an avatar into a 3rd person character

animation,unity3d

That article gives a good overview of what is required. However, you can essentially skip almost all those steps when using autodesk character generator. Here is a quick way: Set your FBX to be a mecanim humanoid Drag an mecanim animator controller onto it Write your code to set the...

SWF works locally but not loaded from server

mod-rewrite,unity3d,swf,swfobject

I did some further tests, sadly there are no errors on the console. But it pretty much looks like there's something wrong with your .swf file on the server, because when I download the file from your server it is not working locally either. (Did you try that before?) How...

Convert a large int to a float between 0.0f and 1.0f

math,unity3d,numbers

You can take your number that ranges from 0 to 500 and simply divide it by 500, e.g. scaled_x = x / 500.0f. Depending on the language and the type of x you will need to divide by either 500 or 500.0f. If you are using a language that has...

Manual slide-in animation using delta time

c#,animation,unity3d

If you really want to be frame-rate independent you should use a coroutine that's how i'd do it : float startWidth = 1f; float endWidth = 10f; float startPosition = 1f; float endPosition = 10f; float positionX, widthX; IEnumerator SlideInAnimation(float slideTime = 0.3f, float expandTime = 1f) { float t...

Unity WaitForSeconds stuck

c#,unity3d

Your code is perfect. That means one of 2 things: DelayTime is excessively large (debug it out) or, more likely: The GameObject is destroyed so the CoRoutine nolonger is running. Try this: void Start () { guiTexture.pixelInset = new Rect (0, 0, Screen.width, Screen.height); StartCoroutine (LoadNextScene ()); } IEnumerator LoadNextScene(){...

How expensive is creating class instance? (performance considerations) [closed]

c#,unity3d

I remember reading a fun post Performance numbers in the pub by Ayendy Rahien. How many CLR objects can you create in one second? And here was the result back in 2011 Created 7,715,305 in 00:00:01 Jokes aside. Create is pretty cheap operation but GC is not. So while you...

Controlling a player using touch input on the mobile device

android,ios,mobile,unity3d,touch

Your trying to call HitTest directly from GUITexture like a static function but HitTest isn't a static function, you need to create a variable from GUITexture class and then call HitTest function from that object like this: public GUITexture guiT; if (guiT.HitTest(touch.position) && touch.phase !=TouchPhase.Ended) { guiT.texture = button2; transform.Translate(Vector3.right*30*Time.smoothDeltaTime);...

Csproj file in unity changes everytime i reload the project

c#,unity3d,msbuildcommunitytasks

As far as I know, you cannot prevent Unity from overwriting your csproj files upon recompilation of your scripts. When working with larger code bases and Unity3D I tend to put most of my code into separate .Net assemblies (DLLs). This helps me when I'm sharing code between multiple projects...

Unity: Prefab parenting in code

unity3d,gameobject

Are you sure you want to Instantiate 10 child prefabs on each frame (Update is called once per frame). I think you problem is, that you did not Instantiate the parent prefab. If I take your code, and fix it, it works like a charm for me. public GameObject childPrefab;...

Unity 3D Text becomes Word Cubes

android,unity3d,vuforia

Your problem is having a MeshFilter on the same GameObject as your TextMesh What you are seeing is the MeshRenderer drawing the wrong mesh, but using the font's material. Those seemingly random letters is what a font texture atlas actually looks like when textured on a cube. What mesh is...

Android - Unity3D freeze in splash screen on some phones

android,unity3d,screen,freeze,splash

Okay , I found the solution. It turns out that one of my script was responsible for this problem. So I deleted it and rewrite another script that do the same job. I assume, script was trying to use RAM over and over , so because of that, Adreno 330...

how to add Scoring to unity3D 2d top down car game?

unity3d,2d,car,topdown

Since this is a racing game, time to complete the race would be your main scoring factor. The faster the player finishes the race the higher the score. As for your question about passing enemy car you can check that by calculating the distance the player has covered on the...

2D game development with Unity3D

unity3d,2d-games

You won't need to purchase any licencing for those platforms. You will need to start paying when your annual turnover is high enough but I doubt you have to worry about that now. See here: https://unity3d.com/get-unity. Unless you make $100 000 a year off of Unity then you can deploy...

Instantiate GameObject at Random time is not working

unity3d

seems like inside Update you are missing a '=' Ie: if (Spawn1 = true) Should be: if (Spawn1 == true) Also to avoid extra processing on Update method you can do this: void Start () { StartCoroutine( AutoSpam() ); } void Update () { // Empty :) } IEnumerator AutoSpam()...

Our iOS developer has developed a game in Unity3D. How do we export it for Android?

unity3d

If you are asking about "one click export for Android" then yes it is a one click export for Android Build Settings > Android > Switch platform > Build But for the question will there be any additional work necessary. Well that depends if you have used any (self made...

Unity 5.1 and OnGUI()

user-interface,unity3d

Your Code clearly Saying KeyCode.Escape and not getting space key change that to KeyCode.Space and it'll work

Android Studio: cannot upgrade google play services

android,google-maps,android-studio,google-play-services,google-play-developer-api

If you are using Android Studio open the build.gradle file and enter inside dependencies dependencies { compile 'com.google.android.gms:play-services:4.2.+' } more info Add Google Play Services to Your Project...

Converting from Pixel Coordinates to UI Coordinates in Unity

user-interface,unity3d

Image img = null // I assign it via the inspector void Update() { if(Input.GetMouseButtonDown(0)) { Vector2 point; RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)img.rectTransform.parent, Input.mousePosition, canvasCamera, out point); img.rectTransform.anchorPosition = point; } } ...

var keyword vs actual type? [duplicate]

c#,unity3d

var means the compiler will determine the explicit type of the variable, based on the usage. One pro is that it requires less typing to declare variables and it's more readable, but can be used only for local scope variables. Also with var, you don't have explicit reference to type,...

Create array/list of many objects(initially unknown amount) by tag

c#,arrays,list,unity3d,gameobject

public List<GameObject> myListofGameObject = new List<GameObject>(); Start(){ myListofGameObject.AddRange(GameObject.FindGameObjectsWithTag("TagName")); myListofGameObject.AddRange(GameObject.FindGameObjectsWithTag("TagName2")); myListofGameObject.AddRange(GameObject.FindGameObjectsWithTag("TagName3")); foreach(GameObject gc in myListofGameObject){ Debug.Log(gc.name); } } Works Perfectly fine for me, Make sure to add the System class for linq generics....

Unity3D Play sound from particle

audio,unity3d,collision,particles

You can use OnParticleCollision and the ParticlePhysicsExtensions, and play a sound with PlayClipAtPoint: using UnityEngine; using System.Collections; [RequireComponent(typeof(ParticleSystem))] public class CollidingParticles : MonoBehaviour { public AudioClip collisionSFX; ParticleSystem partSystem; ParticleCollisionEvent[] collisionEvents; void Awake () { partSystem = GetComponent<ParticleSystem>(); collisionEvents = new ParticleCollisionEvent[16]; } void OnParticleCollision (GameObject other) { int safeLength...

When building to mobile the size of fonts reduce and became very small

c#,user-interface,unity3d,uibutton,unityscript

At a guess, your Canvas' CanvasScaler's UI Scale Mode is probably set to Constant Pixel Size, and if your mobile device's resolution is too high, text will appear small. Try changing the UI Scale Mode to Scale With Screen Size and change the properties it provides as needed. (if your...

How to draw each a vertex of a mesh as a circle

ios,unity3d,shader,mesh,particle

You can do it using geometry shaders to create billboarding geometry from each vertex on the GPU. You can then either create the circles as geometry, or create quads and use a circle texture to draw them (I recommend the later). But geometry shaders are not extensively supported yet, even...

Unity: GameObject.FindGameObjectWithTag isn't working and I don't know why

unity3d

if (sResult = null) { Should be if (sResult == null) { Single = is an assignment operator so you are setting the result to null instead of checking if it is null....

I'm trying to reduce the Length of this Code

c#,unity3d

You could use Math.Min and Math.Max. minXvert = Math.Min(verts[i].x, minXvert); maxXvert = Math.Max(verts[i].x, maxXvert); That would make your code more concise and readable, but won't make it any faster. To make it somewhat faster, you could store x, y, z values in local variables, so they only have to be...

EditorGUILayout.Popup option is not changing

unity3d,unity3d-gui,unity3d-editor

don't use "selected" AND "criteria". you must use the same ONE variable: int selected = 0; ///* string[] options = new string[] { "Start With", "End With", "Contains", }; //selected = EditorGUILayout.Popup("Search Criteria", 2, options); //*/ selected = EditorGUILayout.Popup("Awesome Drop down:", selected, options, EditorStyles.popup); because this is the way your...

Unity setting GUIText of another object

c#,unity3d

if you have gameController = GetComponent<GameController> (); make sure that PlanetController and GameController are actually on the same game object in your scene. if they are not, you will have to use: http://docs.unity3d.com/ScriptReference/Object.FindObjectOfType.html...

Unity: Android and iOS Push Notifications

android,ios,unity3d,push-notification,android-notifications

You are right, someone has done that indeed :) I'm one of developers of the new Unity asset UTNotifications. It does all you need and even more. Please also note that there is no single way to implement the Push Notifications to work with any Android device - there is...

How to make the whole scene in dark on unity3D

unity3d

Create a GUITexture object: in unity menu: GameObject -> Create GUI Texture, let’s call it darkBackground; Attach a dark texture to darkBackground; Disable darkBackground object (you can do it interactively or programatically call) darkBackground.SetActive(false); When paused, turn on /enable this GUITexture game object by calling darkBackground.SetActive(true); ...

What is this programming method called? And is it bad?

c#,unity3d,modular

This is essentially a Service Locator "Anti Pattern" that is (surprise surprise) based around the Singleton Pattern. However, instead of retrieving service instances, you are retrieving object instances. Regardless of the name, this actually does NOT create a more modular application. On the contrary, you are creating hard dependencies throughout...

Unity2D C# - Can't destroy an Instantiated object

c#,unity3d

You must instantiate prefabs like this. PrefabTypeObject obj = (TypeOfPrefab)Instantiate(prefab, position, rotation); or PrefabTypeObject obj = Instantiate(prefab, position, rotation) as TypeOfPrefab; otherwise you will get null object or InvalidCastException like now. Your solution is` clone = (GameObject)Instantiate(swordObject_prefab.gameObject, Player.position, Quaternion.identity); ...

Unity 5 Audio Volume Slider (Solved)

c#,audio,unity3d

The master volume control in Unity is owned by the AudioListener Your code is updating a saved value in PlayerPrefs called VolumeLevel, but it doesn't actually tell Unity to change the volume at any point. To do that globally (i.e. for all sounds at once), you can update AudioListener.volume with...

How to Create Thumbnails in unity

unity3d

When using the new UI objects, as opposed to the Legacy GUI, you must have the image imported as Sprite/UI. Unity Import Reference...

How do I Mute The Audio In Unity 3D?

c#,audio,unity3d,mute

Simply google it, the following is from: http://answers.unity3d.com/questions/52109/how-do-i-mute-all-audio-sound.html AudioListener.pause = true; AudioListener.volume = 0; try this http://unity3d.com/support/documentation/ScriptReference/AudioListener-pause.html...

Formatting large numbers in C#

c#,.net,unity3d,formatting

I am using this method in my project, you can use too. Maybe there is better way, I dont know. public void KMBMaker( Text txt, double num ) { if( num < 1000 ) { double numStr = num; txt.text = numStr.ToString() + ""; } else if( num < 1000000...