[Solved] Do I need to know C# to program with Unity? [closed]

For Unity, you user either C# or UnityScript (A sort of JavaScript variant) for programming game logic, and Cg (Very similar to HLSL) for shaders. If you want to spend some money, though, you can also get node based programming tools (Sort of like Unreal Engine 4’s Blueprints) from the Unity Asset Store for both. … Read more

[Solved] Need help to understand how this part of the code works

I assume it is this part of the line that is confusing: ((1 << collision.gameObject.layer) & groundLayerMask) You could try to read up in “bit fields”, first google hit is: https://en.wikipedia.org/wiki/Bit_field What’s happening here is that “groundLayerMask” is what its name implies, a binary mask which specifies zero, one or any combination of 32 possible … Read more

[Solved] How can I set the android channel notification from code in firebase cloud function?

Solution: It seems that you can assign the category that you want to relate the message: const message = { android:{ notification:{ title: ‘Game started!’, body: ‘Game ‘+ salaName +’ has started!’, channel_id: “notification.category.default”, } }, topic: “topicName” }; Source: https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidfcmoptions 0 solved How can I set the android channel notification from code in firebase … Read more

[Solved] How can I access a variable from another script in Unity?

Try this: public class Particle : MonoBehaviour { public static Particle instance; public float particleSize; public Transform particle; void Awake() { instance = this; } void Start() { particle.localScale *= particleSize; } } public class Magnetic : MonoBehaviour { public Transform magnetic; void Start() { magnetic.localscale *= Particle.instance.particleSize; } } 2 solved How can I … Read more

[Solved] How do i make a child game object affect the parent? [closed]

You should be able to add a collider to the child/head, BoxCollider2D for example. Then you can handle the Collision event and call a method on the parent object. It would look something like: // In the child/head void OnCollisionEnter2D(Collision2D col) { var goomba = transform.Parent.GetComponent<Goomba>(); goomba.Kill(); } This is probably the simplest way, but … Read more

[Solved] Unity warning CS0618: ‘Application.LoadLevel(string)’ is obsolete: ‘Use SceneManager.LoadScene’

As the warning says “Use SceneManager.LoadScene” you should use SceneManager.LoadScene instead of Application.LoadLevel. The only difference is that SceneManager.LoadScene uses indexes of the scenes ordered in Build Settings and Application.LoadLevel uses a string of the scene name. Conclusion: Change Application.LoadLevel to SceneManager.LoadScene and pass in the index of the scene you want to load. If … Read more

[Solved] How do I use variables in a separate script in Unity3D?

You could make a class, instantiate an object of the class and access propterties. Or you could use static variables. Or even beter, lets say you have a GameManager.cs script attached to an empty object called GameManager. And you want to access its variables form the LevelManager.cs script. You do this inside the LevelManager.cs public … Read more

[Solved] Making “Flappy Bird” Game In Unity3D (Flappy Plane), How To Destroy The Obstacles? [closed]

Is MonoBehaviour.Destroy(gameObject) what you’re after? I’m not really sure what part of the process you are struggling with? Edit: With the clarification, below is the revised answer: Track the position of the players co-ordinates, and when an object finds that its own co-ordinates are less that players co-ordinate minus the offset of where the player … Read more

[Solved] Texture Array getting the last index only ( C# UNITY) [duplicate]

for (int i = 0; i < tzPlayInfo.Instance.bc_gametablelist.Count; i++) { dealer_img += tzPlayInfo.Instance.bc_gametablelist[i].dlrimage; dealer_img += “,”; } string[] newLinks = dealer_img.Split(‘,’); for (int i = 0; i < newLinks.Length – 1; i++) { var index = i; // We need to make a local copy because C# captures variables by reference to lambdas. new BestHTTP.HTTPRequest(new … Read more

[Solved] Saving int in Unity using playerprefs

You save like this PlayerPrefs.SetInt(“Health”, 100); PlayerPrefs.SetInt(“Mana”, 10); PlayerPrefs.Save(); If you want to update the values, just do the same. To get a int from playerprefs, just do PlayerPrefs.GetInt(“Health”) 3 solved Saving int in Unity using playerprefs

[Solved] create live wallpaper using unity3d? [closed]

Go to unity store, search for uLiveWallpaper(Indie). It costs 25$. Import it to the unity app. Open uLiveWallpaper window by calling Tools → Lost Polygon → uLiveWallpaper The window consists of three tabs: “Create Project”, “Update Project”, and “About & Support”. To start creating your live wallpaper, first, you must create a Live Wallpaper project … Read more

[Solved] Projectile motion in Unity3d

Let’s be more specific. The projectile is launched from point A and needs to hit B, who is moving horizontally with constant speed in 2D. This is the position of the projectile, over time: P.x = A0.x + VP0.x * t P.y = A0.y + VP0.y * t – g/2 * t^2 And this is … Read more

[Solved] Expecting Identifier Error?

The way you are doing GetComponent is wrong. FirstCamera.GetComponent.<Camera>().enabled = true; instead you should do it like this FirstCamera.GetComponent<Camera>().enabled = true; There is no dot after GetComponent instead inequality signs with the object or class you want get. “Unity GetComponent scripting” Here is the correction to the code : if(Input.GetKeyDown(“f”)) { FirstCamera.GetComponent<Camera>().enabled = false; SecondCamera.GetComponent<Camera>().enabled … Read more

[Solved] unrecognized selector sent to instance AdViewController [closed]

This method is deprecated in iOS5. You must build your project to target iOS 5 or earlier. http://developer.apple.com/library/ios/#documentation/uikit/reference/UIAccelerometerDelegate_Protocol/DeprecationAppendix/AppendixADeprecatedAPI.html You must replace it with Core Motion functionality to move to a newer version of iOS. http://developer.apple.com/library/ios/#documentation/CoreMotion/Reference/CMMotionManager_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40009670 2 solved unrecognized selector sent to instance AdViewController [closed]