Quantcast
Channel: Questions in topic: "unity 5"
Viewing all 13311 articles
Browse latest View live

Unable to load script, when referencing an extension method

$
0
0
I have a really simple extension method that I am calling from a MonoBehavior. When I use the method the Unity project fails to compile and states that the Behavior that is using the extension method can not be loaded, please fix compile errors and assign a valid script. I've included the commented code in the behavior that works if I comment out the extension method call. There are no errors in the Visual Studio project, and everything appears to be in order. **The extension class:** public static class TransformExtensions { public static void Clear(this Transform transform) { foreach (Transform child in transform) { Clear(child.transform); GameObject.Destroy(child.gameObject); } GameObject.Destroy(transform.gameObject); } } **The behavior** public partial class MeasureManager : Singleton { void DeleteMeasurement(Measurement measurement) { //while (measurement.Container.transform.root.childCount > 0) //{ // DestroyImmediate(measurement.Container.transform.root.GetChild(0).gameObject); //} //DestroyImmediate(measurement.Container.transform.gameObject); measurement.Container.transform.Clear(); Measurements.Remove(Measurements.Find(x => x.Name == measurement.Name)); _current = null; } }

Unity null check

$
0
0
Ok, I'm executing this code: _gameData.Initialize(); var mission = _gameData.Missions.ElementAt(0); Debug.Log("Mission is: " + mission.Details.MissionText); if (mission == null) { Debug.Log("Mission is null"); return; } Debug.Log("Mission is: " + mission.Details.MissionText); And I get this output: ![alt text][1] [1]: /storage/temp/80430-null.png How in the world is that possible? Where's the logic? How am I supposed to make null checks now? And how will null propagation from C#6 work with this?

Camera Problem

$
0
0
I build a own server with socket.io and .js But if i just drop a singel camera in the scene all characters just work fine but if a atach to all payers a own camera it stop working fine it al just not work player one steals all the cameras from all charachters thay move but no camera is following thame howcan i fix it ????

Player start moving in air

$
0
0
public class PlayerManager : MonoBehaviour { public float speedUnity; float speed; bool facingRight; bool facingLeft; bool running; Animator anim; Rigidbody2D rb; void Start () { anim = GetComponent (); rb = GetComponent (); facingRight = true; } void Update () { MovePlayer (speed); Flip (); Spawn (); } void Spawn(){ if (facingRight) { speed = speedUnity; } if (!facingRight) { speed = -speedUnity; } } void MovePlayer (float sendedspeed){ if (sendedspeed > 0) { anim.SetInteger ("State", 1); } else { anim.SetInteger ("State", 1); } rb.velocity = new Vector3 (speed, rb.velocity.y, 0); } void OnCollisionEnter2D (Collision2D col){ if (col.gameObject.tag == "BOX") { facingRight = !facingRight; } } Hello. can somebody know how to change code that when i hit play button my player (btw he is in air, i want he start in air) that he first fall on ground and than move, not move immediately in air creating horizontal velocity before he touch ground . Thank you

Problem with Write Access

$
0
0
Hello, I'm developing an app using SQLite database and i had some issues with access this db on Android, but i got it and it works. The problem now is that my app is crashing whenever i try to run it on my device or any other device (sometimes it works). BUT i think i found the root of the problem. When i try to do the build with "Write Access" -->"External (SD Card)" the app crashes, but when i build with "Write Access" --> "Internal Only" the app does not crashes anymore, but i also can not acces the database and i have no idea why it happens. the code blocks below where working just fine after the change mentioned: here i copy the db to Android persistentDataPath folder: void Awake() { filePath = Application.persistentDataPath + "/MGDB.db"; Debug.Log (filePath); //print(filePath); //if(!File.Exists(filePath)) //{ loadDB = new WWW("jar:file://" + Application.dataPath + "!/assets/MGDB.db"); while (!loadDB.isDone) { } File.WriteAllBytes(filePath, loadDB.bytes); //} } and here i connect to the db: if (Application.platform == RuntimePlatform.Android) { connection = (IDbConnection)new SqliteConnection("URI=file:" + Application.persistentDataPath + "/MGDB.db"); connection.Open(); command = connection.CreateCommand(); //print("android"); } Have you any idea about this anomaly?

How to export a Scene as Asset-bundle [Through Command-line args]

$
0
0
Dear Unity Developers, We are trying to create an asset bundle of scene through Command line args. but there is no bundle is creating on destination folder. Note : We are able to create an asset-bundle of content like 3D models and 2D images through Command line args, where as we are giving the unity scene path, it is not exporting the asset-bundle in destination folder. Is there any way to create an asset bundle through Command line args ? Can anyone suggest ?

How do you tilt a platform depending on what side your player is standing?

$
0
0
So I am creating a game that you have to navigate around and collect objects. To make things harder, I want to create some hazards along the way that might make the player fall off if he is not careful. One hazard that I had in mind was that if the player would move to the right side of a platform, that platform will tile down until the player falls off of it or until the player moves over to the left side of the platform, like a see saw effect. Is there a way to accomplish this in Unity?

Change Level by touch the Trigger in unity 5.4

$
0
0
Hi I'm not programmer i'm using mad level manager. Someone can help me? I used this code: using UnityEngine; using System.Collections; using System.Collections.Generic; using MadLevelManager; public class EndRound: MonoBehaviour { void OnTriggerEnter(Collider other) { if(other.gameObject.tag == ("Player")) { MadLevelProfile.SetCompleted(MadLevel.currentLevelName, true); MadLevelManager.MadLevel.LoadLevelByName("SelectLevel"); } } } I have not error, But not working when Player touch the trigger. Trigger is box Collider. Player is unity Stantand Asset Car. I changed main player tag to player. and box collider enable Trigger Thanks for your help...

Unity Daydream Preview - Raycast/camera alignment

$
0
0
I've just rebuilt my Google Cardboard game using the new Unity Daydream Preview, Previously I was using a recent version of the Google VR SDK. I am using a raycast forward from the camera to determine the users gaze and allow interaction with objects via staring at them (actually just a slightly modified VREyeRaycaster from the VR standard assets: https://www.assetstore.unity3d.com/en/#!/content/32351).. During testing I noticed that sometimes I needed to gaze above or below the object before it would register the raycast collision. It was as if the ray or hitboxes had been moved relative to the camera. It seems to be consistent throughout the scene once it had been loaded (e.g. I always have to look slightly above all the objects, by about the same amount, to trigger the action). I also think it is linked to the orientation of the phone when you load the scene, (or possibly the whole game), if I load things with the phone in landscape as if in the headset, the raycast seems to be aligned, if I load things with the phone flat on the desk or at a 45 degree angle that is when it is way off. Any ideas what might be going on? P.S. I've uploaded the version to google play as a public beta if you want to take a look: https://play.google.com/apps/testing/uk.co.softkitty.puzzleroom

When I imported a model from the Unity Assets Store, it made my entire Game View and the Gameobjects inside, poor quality in appearance. How do I change it back?

$
0
0
As the question says, I imported a random flag model from the Assets Store and when I placed it into the scene the quality of everything, not just the flag model itself but my plane and sphere game objects was drastically reduced in the game and play view. I have checked my Graphics Settings which are still placed at 'Fantastic'. I will attach a couple screenshots to show. http://i.imgur.com/PtXBsvO.png (First the scene view, where it appears fine) http://i.imgur.com/DuJF4OV.png (Then the game view where the game objects appear reduced in graphical quality) I removed the flag, assuming that maybe it was that that was reducing the quality. But no change, I think it may be something to do with my Unity itself as the problem carries over on projects.

How to show date?

$
0
0
Why my code don't show the date, only `UnityEngine.Debug:Log(Object)`? PlayerPrefs.SetString("date time" System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); Debug.Log(PlayerPrefs.GetString("date time"));

Integration of Developed Unity App into another developed Native iOS app as part of application by adding subview or any other way?

$
0
0
I want to integrate developed Unity app into one controller of another existing native iOS app as part of application. Can you suggest me which approach will be more easy and helpful. I already tried to add static classes and library of unity app into actual Native iOS app but it is very lengthy and complex process. Can i do integration using pod of developed unity app? is there any way? Kindly Help?

I have light problem in Unity 5.4.1f. Please help.

$
0
0
So i have andoid game and you see in screenshot light have a problem, on phone. ![alt text][1] ![alt text][2] [1]: /storage/temp/80479-kvqnvpgmsm4.jpg But in unity this problem is much smaller but it is still there. Plz help) [2]: /storage/temp/80481-без-имени-2.png

MongoDB C# authentication exception

$
0
0
Hi guys, My database is hosted in mlab.com and I tried to connect it using mongodb C# driver but I am getting following exception when I try to connect to the mlab database. MongoCommandException: Command 'saslStart' failed: Authentication failed. (response: { "ok" : 0.0, "code" : 18, "errmsg" : "Authentication failed." }) MongoDB.Driver.Operations.CommandOperation`1[MongoDB.Driver.CommandResult].Execute (MongoDB.Driver.Internal.MongoConnection connection) MongoDB.Driver.Communication.Security.SaslAuthenticationProtocol.RunCommand (MongoDB.Driver.Internal.MongoConnection connection, System.String databaseName, IMongoCommand command) MongoDB.Driver.Communication.Security.SaslAuthenticationProtocol.Authenticate (MongoDB.Driver.Internal.MongoConnection connection, MongoDB.Driver.MongoCredential credential) Rethrow as MongoSecurityException: Error: 18 - Authentication failed. MongoDB.Driver.Communication.Security.SaslAuthenticationProtocol.Authenticate (MongoDB.Driver.Internal.MongoConnection connection, MongoDB.Driver.MongoCredential credential) MongoDB.Driver.Communication.Security.Authenticator.Authenticate (MongoDB.Driver.MongoCredential credential) MongoDB.Driver.Communication.Security.Authenticator.Authenticate () MongoDB.Driver.Internal.MongoConnection.Open () MongoDB.Driver.Internal.MongoConnection.GetNetworkStream () MongoDB.Driver.Internal.MongoConnection.SendMessage (MongoDB.Bson.IO.BsonBuffer buffer, Int32 requestId) Rethrow as MongoConnectionException: Unable to connect to server dsXXXXXX.mlab.com:XXXXX: Error: 18 - Authentication failed.. MongoDB.Driver.Internal.DirectMongoServerProxy.Connect (TimeSpan timeout, MongoDB.Driver.ReadPreference readPreference) MongoDB.Driver.MongoServer.Connect (TimeSpan timeout) MongoDB.Driver.MongoServer.Connect () Below is the line which throws the error. client = new MongoClient (new MongoUrl("mongodb://:@dsxxxxx.mlab.com:xxxxx/mydb")); And the db user has admin rights as well...username and password are also correct..Need some help :-)

What was the system requirements for unity 5.1.1

$
0
0
I just wanted to know the system requirements of unity 5.1.1

What would happen if you were to install unity 5.4.3 on Windows Vista

$
0
0
What would happen if you were to install unity 5.4.3 on Windows Vista because I have a windows vista and I wanted to upgrade to the latest

Loading a random scene/level.

$
0
0
Imagine I had 4 levels: MainLevel, Level1, Level2, Level3. I would like the player to enter MainLevel and after a set amount of time (seconds) either level 1,2 or 3 will be loaded at random. I am aware of the "Application.Loadlevel" and "WaitForSeconds" scripts however I am unsure how I randomly select a level from a set group. I'd like to be able to drag levels into bars in the inspector tab, that way, the script may be used on multiple times. I think this is set using String variables. Not asking for a full script, just looking for some groundwork and a place to start. Thank you for your help, I am new to coding. (Sorry mods' if this question has already been asked but I could not find the exact answer I needed.)

Android Unity, Screen Recording and MediaProjection APIs - UnityPlayerActivity hang.

$
0
0
I work on a project that uses MediaProjectionManager, MediaProjection and VirtualDisplay in order to record game play. This project also switches away from the UnityPlayerActivity and back every couple of minutes. On the latest Unity, after starting my screen recording utility, I then switch to the UnityPlayerActivity: activity.finish(); activity.startActivity({Intent starting the UnityPlayerActivity}); SceneManager.LoadScene()> After doing this, the first time, the UnityPlayerActivity starts just fine, and my game switches from my native activity to my game scene and continues running. When game play finishes, I then switch back to my Native activity by calling static Java methods from UnityScript to trigger the change: unityPlayerActivity.startActivity() My activity then starts up just fine. However, when I go to switch back to the UnityPlayerActivity a second time, it has hung. All rendering stops, and no messages I send it are received. This hang happens no matter which scene I try to trigger, whether or not I try to close out my screen recording utility, and whether or not I try to start my screen recording again on this second switch. At this point, I've narrowed it down to the screen recording via trial and error removal of code, as no exceptions are thrown or logged. I'm fairly certain that the creation of the VirtualDisplay and MediaProjection are causing this issue. mMediaProjectionManager = (MediaProjectionManager) unityPlayerActivity.getSystemService(Context.MEDIA_PROJECTION_SERVICE); mMediaProjection = mMediaProjectionManager.getMediaProjection(mResultCode, mResultData); mVirtualDisplay = mMediaProjection.createVirtualDisplay( "recorder", mStream.getVideoQuality().resX, mStream.getVideoQuality().resY, DisplayMetrics.DENSITY_LOW, DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR, mSurface, null, // callback null // handler ); Removing the creation of these from my screen recording utility clears up all of my problems, as does removing the screen recording utility entirely. This worked fine on Unity 4.x, but upon updating my project to 5.4, it's 100% reproducible. Would anyone have any ideas on what could be going wrong, or how I could debug this issue?

In Unity2D,when i use UGUI in Canvas(Screen space - Camera), i do not know how to set its position.

$
0
0
when I use UGUI, i do not know how to set its postions , the world space position or screen space position,please give an answer? thanks a lot !

iOS Build Crash : task_set_exception_ports(B07, 400, D03, 0, 0) Error

$
0
0
Hi, I am trying to build for iOS (Unity 5.1.2, XCode 8.0) and having the crash with the following error **task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4 : (os/kern)).** Error occurs on splash screen. In another post, Someone said that It occurs when you try to access deleted pointer. If that's so, then how do I solve this problem? Thanks.
Viewing all 13311 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>