• 10
• 10
• 12
• 12
• 14
• ### Similar Content

• We're looking for a Unity (C#) Programmer for our 2D Project. We're looking for a new lead programmer to continue with an existing project.

Project is an open-world RTS, and is very close to a prototyping (playable) phase. Our existing lead, unfortunately, has no more time for the project, and thus we are in search of a new one who is interested.

Game is purely fantasy based, and we'll be able to give you much more detailed info about the project as we begin to work you into it.

You'll be working with our junior developer, who has been here since the beginning.

Primary skills needed are just being able to work within Unity. But skills within XML are also a plus.

Our list of major goals we'd need you to do is minimal, yet still fairly extensive:
-Edit our current Pathfinding system to account for a few extra features.
-Setup our global map system. You’ll be working off an existing random node-map web generator and existing random map generation system and essentially linking the two together. This includes handling random spawns (which has already been semi-setup) unique to each node’s respective map.
-Further implementation of an existing random spawning algorithm (used to spawn things like enemies randomly across the Map).
-Making sure to Save and Record all respective aspects of what was mentioned above.
-Handling our XML database- database is created, but we’ll need to be integrating it. This includes all various things from units to abilities and so forth. Will also need to handle implementing an object’s unique attributes we cannot take care of within XML.
-Various Content Implementation (to be done once our XML has been integrated).
-Various Saving and Recording of all respective aspects of the database info mentioned above.
-Various Performance Enhancements.
-Potential for various misc things, such as further UI work.

We have a considerable amount of things done already- however I must warn ahead of time we have quite a bit of unclean code, which may be fairly overwhelming for a new developer on the project.

Let me know your rates per hour, and we'll see if we can work out a good deal between both of us. Royalties are also included.

If interested, send an email to: eldwin11929@yahoo.com

Thanks!
• By jhocking
My bestselling and highly recommended Unity book has been fully revised! Unity in Action, Second Edition teaches you to write and deploy games with the Unity game development platform. You'll master the Unity toolset from the ground up, adding the skills you need to go from application coder to game developer.

Foreword by Jesse Schell, author of The Art of Game Design

Don't take my word for it being good, look at the sky-high ratings on GoodReads.

You can order the ebook directly from the publisher's site, or order the book on Amazon to get both the physical book and a coupon to download the ebook!

• Hello! So, I've been the leader of BJP for a while now. I'm a bit bored of taking the role I always take, leader. I was hoping someone out there is looking to forge a team maybe and needs a programmer.
I have experience mainly in the Unity engine(C# intermediate) and I have a very small amount of knowledge on Shaders, as well as experience on developing games(usually end up stuck in dev hell) and leading experience from my last team which at one point reached 11 people. I personally love the Unity engine and prefer to use it as it's the development environment I'm comfortable with.
I have used Unity for over a year and a few months, I'd consider myself an intermediate at the Engine, but to this day Unity still surprises me.
I live in the United Kingdom, I find it a bit strange to work with other programmers as the ones I've worked with tend to leave their code heavily unoptimised and I'm a on the go optimise kind of guy, I also like to get things done quickly.

If you're a new team and need a programmer that has high levels of ambition and strives to maintain the motivation throughout the team, then I'm your guy. I don't care if you're just beginning because I'm all for helping people learn!

To finish this off: I like to get things done and I like to get them done right the first time, if I fail I will do it again and again, etc, until I loose all motivation. So if you're a modeller or an artist, please don't leave me to do all the modelling/art as well as the programming and sound. I do have experience in all those areas but my main power is in programming and I'd prefer to keep it that way.

[If this was posted in the wrong forum, sorry, I don't really know the layout of this website yet]

• Hello guys,i am writing this topic to get to the opinion of more people.I have just released my first game for android(worked on it for about 5-6 months in my spare time) i used Unity framework and i am planning to make it a big project but i had to release 1.0 version so i am 100% sure i wouldn't quit the project at some time.What i am asking any of you guys is to give me your opinion about the game. What do you like,what you don't , is the ad too irritating?is the GUI okay?any information you might consider usefull for me would be helpful,thanks in advance!

• I've got a custom Brick class. I need at least one other type of Brick subclass, maybe more. These classes should do most of what the Brick class does, but have a bit of modified or added behavior. Normally I would assume inheriting from the Brick class would be the best choice for this, but when I tried to do it I was having some issues because of having to make additional instances of variables referencing manager objects. I'm not sure if I was just doing it wrong, or if maybe inheritance isn't the right solution here. Here is the Brick class:
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Brick : MonoBehaviour { public AudioClip crack; public Sprite[] hitSprites; public static int breakableCount = 0; public GameObject smoke; private LevelManager levelManager; private int timesHit; private bool isBreakable; private float delay = 1.5f; //Delay till bricks move down 1 row. private float timer = 0; // update ever frame and compare to delay. // Use this for initialization void Start () { isBreakable = (this.tag == "Breakable"); //keep track of breakable bricks if (isBreakable){ breakableCount++; } timesHit = 0; levelManager = GameObject.FindObjectOfType<LevelManager>(); } // Update is called once per frame void Update () { timer += Time.deltaTime; if (timer >= delay) { transform.Translate(0.0f, -1.0f,0.0f); timer = 0; } } void OnCollisionEnter2D (Collision2D collision) { if (collision.gameObject.tag == "EndScreen") { levelManager = GameObject.FindObjectOfType<LevelManager>(); levelManager.LoadLevel("Lose"); } AudioSource.PlayClipAtPoint (crack,transform.position); if (isBreakable) { HandleHits (); } } void HandleHits () { timesHit++; int maxHits = hitSprites.Length + 1; if (timesHit >= maxHits) { breakableCount--; levelManager.BrickDestroyed(); PuffSmoke(); Destroy (gameObject); } else { LoadSprites(); } } void LoadSprites () { int spriteIndex = timesHit - 1; if (hitSprites [spriteIndex] != null) { //if statement keeps it from loading nothing if level designer forgets to assign a sprite this.GetComponent<SpriteRenderer> ().sprite = hitSprites [spriteIndex]; } else { Debug.LogError("Brick sprite missing"); } } void PuffSmoke () { var smokePuff = Instantiate(smoke, transform.position, Quaternion.identity); var effect = smokePuff.GetComponent<ParticleSystem>().main; effect.startColor = GetComponent<SpriteRenderer>().color; } } What I need is for a different kind of brick to destroy all other adjacent bricks when the ball hits it. I considered just adding this functionality in to the brick class, and have it activate based on tags, but that didn't seem like the best solution. I'm open to any ideas. Thanks!

# C# assigning a property from an object in a list to a variable

## Recommended Posts

Maybe I didn't explain it clear enough in my last post. I have mixed my lists up.

currentPosition = gridPositions[randomIndex].Id;

Here I am assigning the Id to currentPosition. What you all are saying is correct. Id is equal to the index. However, the code SHOULD have been like this:

currentPosition = gridOptions[randomIndex].Id;

Here I am assigning the Id of the index of gridOptions to currentPosition. This is what I actually meant to do. The Id here will not be equal to the index because gridOptions can only ever have up to 4 elements. But I need to track the where those 4 elements came from in the gridPositions list. So instead of comparing vector3's till I find a match, I just created an Id.

##### Share on other sites

You should really work on your variable naming. A variable named currentPosition shouldn't point to an identifier. A position is a position.

##### Share on other sites
12 minutes ago, Lactose said:

You should really work on your variable naming. A variable named currentPosition shouldn't point to an identifier. A position is a position.

I guess I can understand from an outside point of view, but what would you suggest I name it? currentPositionId? It may be an identifier but it's an identifier for a position. It made perfect sense to me. But I can see where it could be confusing if you don't know everything that's going on.

##### Share on other sites
6 minutes ago, ethancodes said:

suggest I name it? currentPositionId?

currentGridId because it will in fact get the position from the grid. That would be my choice.

3 hours ago, ethancodes said:

The Id here will not be equal to the index because gridOptions can only ever have up to 4 elements.

It is still possible, if less likely, to have the same index. Maybe use some kind of ID structure to avoid confusion example 10001 followed by 10002 etc. Or a string ID like Bethesda uses "0000000f" etc.

Is your code doing what you want it to do now?

##### Share on other sites

It seems to have fixed part of the problem but it's still doing some weird stuff. Earlier someone had said that how I was getting my random was not correct. This part here:

randomIndex = Random.Range (1, gridOptions.Count);

How should I be doing it if not like this?

##### Share on other sites
15 minutes ago, ethancodes said:

How should I be doing it if not like this?

You are starting from 1. So if there was 4 values you would get: 1, 2 and 3. However a array starts from 0 so you need 0,1,2,3; for the index. By starting from 1 you can never get the first item in the array unless you subtract 1, but then the last item can't be reached.

##### Share on other sites

Just as an update. I did find 2 more issues. One was a simple mathematical mistake. Now it is working the way I want mostof the time (except maybe the randomIndex part, but I'm not sure if that's an actual issue yet or not?) However, in edge cases, where I wouldn't assign something to the gridOptions list, I'm getting an error. The reason for this error is kind of confusing to me. When I debug, it shows that this list is already predefined with 4 elements all set to null. I'm confused because I thought lists should be dynamic? Maybe there's something I'm not familiar with. But this is a problem because if I have a null, then I get an error. Any ideas on why this would happen?

Just now, Scouting Ninja said:

You are starting from 1. So if there was 4 values you would get: 1, 2 and 3. However a array starts from 0 so you need 0,1,2,3; for the index. By starting from 1 you can never get the first item in the array unless you subtract 1, but then the last item can't be reached.

Yea I caught that and changed it, thanks. Not sure how I did that. Other than that it's ok though?

##### Share on other sites
11 minutes ago, ethancodes said:

Yea I caught that and changed it, thanks. Not sure how I did that. Other than that it's ok though?

Yes. The rest is correct. If you are wondering why my random is done differently it is because as a Trading Card Game(Yes real trading so they count as gambling games) developer I use a true random library that includes the last number.

I think with the C# random if you did Random.Range(0:1) it only returns 0.

18 minutes ago, ethancodes said:

it shows that this list is already predefined with 4 elements all set to null

Isn't that what you want? If there wasn't a null value it would have given a "Index out of range" error, with null objects you can check if the object is null. You can set a list to be empty by creating a empty one:

List<Object> MyList = new List<Object>(); //This list has no values

MyList.RemoveAt(Index);//Removes the item at index
MyList.Remove(Object);//Removes object from list

//If the null objects remain:
MyList.RemoveAll(Object => Object == null); //Look just realize today that c# supports Lambda and already my bad habits are back :P

##### Share on other sites

Yea you're right I can just check to see if it's null and then adjust if it is. Maybe I don't fully understand how lists work, but I thought they were supposed to be dynamic, so I was confused why I would have null elements? The way I had the code set up is so it would just pick any element in the list. So it didn't matter how long it was. If there was only one option, then it picks that one. However, now if there is only one option, it may pick a null, which means I need to do more work to make it check the next, then the next, and so on until it finds one that has something. My main question here is why is it making null elements? Why isn't it acting dynamically? From what I found online, the only thing I saw was maybe because its an object that's going in there? Any clarification on this would be great.

##### Share on other sites
5 hours ago, ethancodes said:

My main question here is why is it making null elements? Why isn't it acting dynamically?

It is dynamic. You have to use Add and Remove to keep it dynamic. Also don't give it a defined size at start:

List<int> MyIntList = new List<int>(0);//Make a empty list
print (MyIntList.Count); //returns 0

print (MyIntList.Count); //returns 1

MyIntList.RemoveAt (0);  //remove the first item
print (MyIntList.Count); //returns 0