Search Unity

noob to pro in one week

Discussion in 'Works In Progress - Archive' started by iamthwee, Dec 5, 2015.

Thread Status:
Not open for further replies.
  1. Prototypetheta

    Prototypetheta

    Joined:
    May 7, 2015
    Posts:
    122
    If you've already got the background in 3D work then it might be easier for you, but I can't decide that.

    Also no, the raycasting is not necessary, it's just an alternate but potentially more reliable method of collision detection. I'd reccomend you learn how to use raycasts, but at this stage it's not necessary.
     
  2. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    Thanks passerby and proto for the clarification, that gives me something to work on. Most importantly, it stops me from exploring an avenue that might be more difficult to code, time I don't have in a noob to pro in one week thread lol!
     
    Last edited: Dec 7, 2015
  3. CaoMengde777

    CaoMengde777

    Joined:
    Nov 5, 2013
    Posts:
    813
    idk i find 3D animating WAY easier than 2D .. well if you want to do it accurately.. for 8 directions of movement, like a topdown thing .. 3D you just animate a walk cycle once and its automatically there correctly in all perspectives, 2D you gotta like "guess" (figure out) the correct perspectives from whatever angles you want...
    .. but yeah iam like too perfectionist with that stuff sometimes lol

    but yeah it all depends
    .. like i was working on a whole bunch of swords and armor etc and i tried in 2D few years ago and it was a real pain having to make each item all perspectives, 3D just do it once.
     
    Last edited: Dec 7, 2015
  4. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,615
    why is this even a WIP thread?

    WIP is generally for games people are creating. Not for following a week of tutorial progress. This is just noise taking away from anyone doing something serious.

    come back in three years when youve moved from noob to intermediate and show us something good.
     
  5. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,823
    It's taken me five. G'luck.
     
    JamesLeeNZ likes this.
  6. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,383
    Not sure if you already know, but this thread was started from this discussion (http://forum.unity3d.com/threads/no...ossible-to-make-a-good-game-in-a-week.371754/).

    If anything, I think this thread can help other newbies realize how much or how little you can get done in a week, especially for those without any experience at all.
     
    AndrewGrayGames and HemiMG like this.
  7. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,383
    I've had my own internal debates about which type of animation is more difficult, and this is the generalized conclusion that I've come to:
    • 2D animation is more tedious (there's a lot more work to do, but you have a lot more control over the final result).
    • 3D animation is more frustrating (it's extremely difficult to get a character animation to do *exactly* what you want. Typically, animating one bone hierarchy will completely screw up another bone hierarchy, especially with IK and child props).

    Pick your poison.
     
    Whiteleaf and AndrewGrayGames like this.
  8. gamegirl1984

    gamegirl1984

    Joined:
    Nov 6, 2014
    Posts:
    102
    How is your game coming???? I hope you come up with something in a week, but, I started unity in November of last year with no knowledge in coding, design or anything. Had no idea what i was doing. I had gotten my hands on an Oculus Rift DK2 and then found out about Unity from the spash logos on all the Rift Demos and looked it up! I was like, what?? Its free?? If i would have known about unity or how easy it is to make a game i would have done it long ago. Anyway, i dove head first into Unity and made a full experience/game for the Oculus Rift. It took me one month. And most of that month was learning how to use unity and code. I watched hours of YouTube videos and spent hours searching the Unity Answers. Anyway, if you interested in seeing what funny buggy game I came up with,after a month, its Called Nightmare Island. You could probably watch someone playing it on YouTube if you don't have a Rift.

    I took a break for about a year, then started unity again this last October and made another small experience that took about a month. Now i'm actaully working on a full game for PC and the Rift. I know its going to take a long time because its been a month and I only have about 5 min of actual game play. LOL But its going to be awesome!!!!

    I Wish you luck on your adventure!!!! I can't wait to see what you come up with!!!!

    Also, if you feel like the coding part is just to time consuming (with learning it and actually doing it) Look into visual scripting. Its a life saver!!! It took me less than half the time to code something. You just need basic knowledge of coding and you won't have to write a line of code. I use Blox2 for visual scripting, but their are alot of different apps.
     
  9. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    Wow gamegirl, that is really good, I'm assuming it is this:



    As the other nightmare game looked more polished. My progress, has almost stalled as I'm struggling hard to figure out animating a 2.5D character, part of the trouble is there are so many buttons and options to look at, plus what doesn't help is that the youtube vids sometimes use deprecated code examples not applicable to unity five. As of yet I can't figure out to get my animation to play locally, where I place it. It keeps snapping to a default position as soon as I fire the play event. Maybe I need to parent it to an empty.

    Your video has given me an idea for a horror style game if I can get to day 7, so stay tuned. But it's a long way off haha. We shall see.

    ***Edit, about the visual scripting, yeah I heard it is something like unreal but you have to pay for it. It is a shame unity haven't released something like this for free. But at least with vanilla coding you learn things well, the hard way.
     
    Last edited: Dec 8, 2015
  10. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,823
    Something I'd like to see is generally more mature visual scripting tools. The human brain is a pattern-recognition machine; organizing instructions by where they are in space just seems like a natural next step for programming in general. And this is coming from a career programmer who writes C# in any number of text editor, on a daily basis!

    TL;DR - I really want to see the 'Visual' put into 'Visual C#!'
     
  11. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,481
    Why i like the hybrid system epic made for ue4. Really cool concept how you can extend code classes with blueprints of extend blueprints with code. Gets you the best of both.

    Since you must admit there are somethings that are just messy and hard to follow logic with while using nodes
     
    Last edited: Dec 8, 2015
    iamthwee and AndrewGrayGames like this.
  12. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,615
    Well all they have to do is try. Not sure a thread about one persons attempt proves anything.
     
    AndrewGrayGames likes this.
  13. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,823
    They did find the right subforum, though. ;)

    Start by working on making a 'clone' of a simple game that you like...but add a twist to make it more unique. A great example is in the Game Design forum - check out the Christmas Feedback Friday thread, to see a game by @Aiursrage2k that does just that.

    Do > Show > Tell.
     
  14. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    wip.jpg End of Day 3

    After what can only be called one hell of a slog, I managed to figure out how to do stock animation in unity. I like the rigging system.

    -What I found works for me, the export to fbx is buggy so I didn't use this.
    -Once the model is added, you have to drag it into the scene then this order is important.

    -Click on the select button > click on rig > use legacy option > click apply > click on animations >tick add loop frame box, choose wrap mode loop > click apply.

    Textures, need to be added as shader unlit > transparent cutout, especially if you're using a transparent png.

    Attaching a script to play the animation on keypress can be done by:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class DummyScript : MonoBehaviour {
    6.  
    7. //Usethisforinitialization
    8. void Start () {
    9.  
    10. }
    11.  
    12. //Updateiscalledonceperframe
    13. void Update () {
    14.  
    15. if (Input.GetKeyDown("space"))  {
    16.  
    17. //gameObject.GetComponent<Animation>().Play ();
    18. GetComponent<Animation>().Play("Armature|idel");
    19.  
    20.   }
    21.  
    22.   }
    23. }
    24.  
    Parenting the rig to a rigid body like a cube, will allow to fully utilise the inbuilt physics so you don't have to write it yourself.


    What I learnt
    You probably don't want to try and learn unity's rigging animating system in one day. It is too tough. Each plane needs to be parented to a bone. 2.5D animation would probably yield faster results than 2D sprite animation although 2D sprite sheets allow more customization. If I had time I would have like to have added a platform, enemy and a point scoring system, with an overlay scene, showing health no. lives and total point score.

    Luckily, this task practically covers me for Day 3 which I failed, import and model into unity rig and animate him. I'm almost certain the same principles can be used for 3D stuff. There's probably a lot more to uncover. But for today that's me over and out... still behind schedule. Thanks for watching.

    run.gif
     
    Last edited: Dec 9, 2015
    Whiteleaf likes this.
  15. Prototypetheta

    Prototypetheta

    Joined:
    May 7, 2015
    Posts:
    122
    Generally you want to work out your mechanics with a placeholder first. Then faff about trying to make it look good.
     
    iamthwee likes this.
  16. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    Yeah good point.

    Day 4 Plans
    -Figure out how to move a cube on a scene, jump, collision detection.
    -Figure out how to use the first person camera, figure out raycasts and gun shoot with texture
    -Figure out how to respawn, and restart the level.
    -Figure out how to spawn (instantiate a bullet)
    -Figure out how to start particles using code.
    -Figure out how to turn point lights on and off.
    -Understand the difference between update and fixedupdate
    -Understand awake and start

    Basically, it's going to be a coding day, and figuring out how things work. Boring, but necessary.
     
    Last edited: Dec 9, 2015
    Yash987654321 likes this.
  17. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    657
    Just a small note, it's not for putting you down. I like the enthusiasm.
    I just want to say that the way a pro codes, is not that he/she knows everything by heart, but more that they will write efficient code. Writing code in a way that isn't written in the tutorials because they are implied to be for starting you up.
    For example, as far as i know, checking a tag with .tag=="somethingsomething" is more resource intensive than .CompareTag("somethingsomething"). Even if it's not mentioned anywhere. (Or at least i think it isn't).
    Also not to use getcomponent in a loop, or if in a script you write you don't need the update loop, delete it from the stuff that unity puts there automatically as it'll be called and checked even though it's empty.

    Also, if you have a rigidbody, don't move via transform.position, but via the functions in the rigidbody class.

    It's more important to know why you put stuff there instead of what to put. If you know the why, then it'll be easier to understand what you need and don't do any unnecessary coding.
     
    iamthwee and Haseeb_BSAA like this.
  18. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    Thanks that's brilliant to know, is there some link with all these pointers on a single page, where possible I'm following 'unity' tutorials to ensure I use best practices, deleting unused objects access the correct methods. Of course, I won't always be using unity's code examples, but yeah.
     
  19. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    657
    @iamthwee um... not really. can't remember an exact one. It was more like spread over lots of places like the forums, blogs and unity answers when looking for optimization tips. For example i once noticed on a previous project that when i would instantiate a lot of object with a shadow projector component, things would end up in a crawl when on mobile.
    After looking closely at the performance panel in the play window and asking around, i found out that the projector component actually works by copying the mesh it is affecting. So i stopped using that on more than one or two objects at a time. Also, forum users informed me that it's better to NOT instantiate objects a lot, but rather have a pool of the object i'll need in the future in an array, and just enable one of them when needed, and then disable it instead of deleting it.
    Instantiating/deleting stuff all the time creates a lot of garbage in the memory that needs to be cleaned up, and that makes stuff stutter.
    These stuff were discovered when i started googling for Unity optimization tips.
     
    theANMATOR2b and iamthwee like this.
  20. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    End of Day 4

    Ok boys, I've got to be honest, today I don't have much to report, I had a bit of a drop in motivation today, but I did get myself through a lot of basic scripting tutorials, including, movement, transformation, collision detection and instantiation.

    What I learned
    c# coding is tricky. The intellisense is supposed to make it easier to work with, but even simple things like rotation, has to be looked up. I think the syntax is a bit too verbose. Also the mixture of unity prior to 5 syntax caused more difficulty in testing (on the learning resources I've used obviously not on the unity page itself). The youtube tutorials and internet snippets are a mixture of both. In short c# is the biggest ballache know to civilisation, not too far behind java or any scripting language (but then can we expect nothing less from microsoft :)

    Day 5,6,7 I hope to have something to show. And I'm already starting to think about what game I might like to create. So many great inspirations from the people who have already contributed. passerbycmc invaluable advice, Screenname, love your ball roll twist, Prototypetheta, love the 2d platform, am I keen on creating sprite sheets though? Probably not, aeroace, love the goul/ghost game where the enemies spawn at you, JamesLeenz, some great ideas, the parkour thing really caught my eye, but overall gamergirl's contribution really inspired me. 3D platform with a modern horror twist, on a rift! And her way of learning holds a special interest to me, yeah, I'm watching hours of youtube videos, just like you. This is really up my alley... so I'm already beginning ideas for a first person type horror game to end on Saturday/Sunday. Sorry if I've not mentioned anyone else.

    Thanks for all the inspiration/tips and support. (Special thanks to whiteleaf, sorry bro forgot ya and caomengde)

    Until tomorrow...
     
    Last edited: Dec 10, 2015
    Haseeb_BSAA and Whiteleaf like this.
  21. Whiteleaf

    Whiteleaf

    Joined:
    Jul 1, 2014
    Posts:
    728
    As long as you have a game with actual gameplay art should not be your main priority. Sure, it looks nice in the end, but in reality gameplay triumphs graphics--most of the time. Plus this is practically one of your first games(in Unity, at least), so don't pressure yourself.

    Good luck.
     
    iamthwee likes this.
  22. PenguinEmporium

    PenguinEmporium

    Joined:
    May 30, 2013
    Posts:
    134
    I am quite impressed. Your learning unity faster than I could.

    Keep going!
     
    Haseeb_BSAA and iamthwee like this.
  23. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,383
    Programming in general is tricky/complicated/difficult. That's why software engineers get paid significantly more than other disciplines in the game industry.

    You think C# is verbose? Try Java.... ;)

    One of the many pains of software development, and one of the many reasons why more experienced developers will tell you it's "unreasonable to make a good game in a week".

    Thanks for trying the game! I know it's very light on gameplay, but it still took an incredible amount of time, energy, effort to get to that level of completion and quality, and I still have many plans for continuing development.
     
    iamthwee likes this.
  24. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    @penguin, that's got me motivated again, wonderful ;)

    @aeroace thanks for the insight.

    End of Day 5
    Okay boys nothing solid to report. I ended up going over the ball roll and space shooter tutorial again, maybe watched this series 2-3 times over, maybe more. Just absorbing as much as I can. What I learned, the importance of creating prefabs and empties. Making the collectables rigid bodies but with inverse kinematics. The difference between start() and fixed update and ontrigger. I also learned about the GUI canvas inside unity. By learned I mean I just watched.

    I don't think the other tutorials are good for noobs, it is too advanced, I skipped the tank game and guy with a bobbing hat game. Much too advanced and would go right over my head. I also learned about isTrigger, to detect a collision without reacting like a rigid body would. Boring stuff I know, I also started watching a first person shooter tutorial with raycasting.

    This gives me two days to bang out something solid at the end. I really wanted to make a Horde game or parkour game or horror island game by the end of the week but now I don't think I've got enough time I think :(
     
    Last edited: Dec 10, 2015
  25. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    Boys does someone have a layer tutorial, I just don't get how you put different planes on different layers? And a raycast tutorial would be awesome for unity 5.
    Thanks in advance, iamthwee.
     
  26. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Layers:


    If you want planes on different layers, just select the first plane, pick the layer for it, then select the second plane and use another layer for it.

    Raycasting:


    Both were not changed for Unity 5, so the old tutorials should still be valid.
     
    iamthwee likes this.
  27. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    Brilliant and not too long either, so I can watch this now and be ready for tomorrow. Thanks boys.
     
  28. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    Dantus can you target code for specific layers, if so how, and is it useful to do this?
    @gamegirl1984 do you have any tips for an aspiring noob to create an fps in 2days, any things you could pass on you, what would do differently etc, what helped speed things up, what slowed you down?
     
    Last edited: Dec 10, 2015
  29. Jegorovas

    Jegorovas

    Joined:
    Nov 20, 2015
    Posts:
    6
    my advise as beginner to beginner - dont do anything crazy like fps in your first week :) do some bouncing ball kind of game you would learn so much more than doing fps in your first week, like I did my "Plants vs Zombies" , I thought ok I wanna do something nice Im gonna take it bit by bit , learn while im doing it - hell no :) I ended up lost, struggling in every step i take , frustrated because I could learn so much more doing something easier , well lesson learned... Or not, because im still gonna finish my game as i went too far to stop right now :)
     
    iamthwee likes this.
  30. Dennis_eA

    Dennis_eA

    Joined:
    Jan 17, 2011
    Posts:
    255
    I like your enthusiasm, too.
    but I don't like the way you titled your journey "noob to pro".

    This sounds like the story of a boy who just made his driving license (in one week lol), and then expects that Ferrari will hire him as a driver for their next GP because he is a effing PRO :rolleyes:;)
     
  31. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    iamthwee likes this.
  32. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,481
    Your concern should not be speed at which you do things. If you want to get good at anything you need to work on the quality of your work first. You need to make sure you are internalizing what you are learning. Once the quality of work is there, than you can work on speeding up your workflow
     
    Dantus likes this.
  33. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    Boys, I'm watching the ball roll and space shooter tutorial yet again lol. It is starting to get on my nerves! So you recommend, gameplay with primitive un shaded objects first. Good ideas.

    Boys I'm logging off soon as I'm wasting too much time here lol but few more questions, how do I get SSAO and bloom working in my game, how do I use the reflection probe and does it give me real time reflections like in a puddle or something? Does unity 5 even have this?

    Is it wise for a noob to use the firstperson controller and scripts from the assets or should I try writing my own?

    Thanks in advance.
     
    Last edited: Dec 11, 2015
    Haseeb_BSAA likes this.
  34. Patico

    Patico

    Joined:
    May 21, 2013
    Posts:
    886
    One week is not enough of course, but anyway we're glad you are here. Welcome to the unity family :)
     
    RavenOfCode, Haseeb_BSAA and iamthwee like this.
  35. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    Thanks bro
     
    Haseeb_BSAA likes this.
  36. Whiteleaf

    Whiteleaf

    Joined:
    Jul 1, 2014
    Posts:
    728

    For SSAO and Bloom you import the Image Effects package: right click in project window > import package > effects > import all

    I haven't messed around with reflections too much but I'm pretty sure there are realtime reflections, but it won't have any ripples or waves like water or a puddle would.

    Yes, I'd say it's fine to use the standard character controllers. Eventually you'll make your own as you find the new ones they made have uneeded features and overall kinda annoying. I have switched to my own but I highly recommend the standard ones for beginners.
     
    iamthwee likes this.
  37. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    Thanks wow that was easy, you just import the asset effects and drag the one you need onto the camera, and boom, realtime bloom, SSAO and vingetting. Guess you have to use these sparingly as it probably eats up performance.

    Still can't seem to work out real time reflection probes, but I probably don't need these just yet.
     
  38. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    tin.jpg

    OK boys,

    Been messing around with filters like bloom, vingettes etc... Don't feel like I achieved anything, I just dropped Tin, Tin lol into my scene, for my upcoming horror clone of gamegirl's horror island, as mentioned by whiteleaf, assets > import character controller. What I learned is you have to turn of ambient lighting under window lighting to get a completely black scene with no ambient lighting. Also the shadows are pretty crappy, I changed the quality settings to the highest. Am I doing somthing wrong?

    How do I give him a gun and shot holes in the wall, anyone got some good tutorials?

    32KQkyHKKT.gif
     
    Last edited: Dec 12, 2015
  39. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    657
    I'm not familiar with Tin, but the easiest way would be to parent a gun to the model's palm i guess.
    Or to the palm's bone. For the bullet holes, i'd raycast a single ray from the gun and would create a decal at the point of impact with a wall.
     
    iamthwee likes this.
  40. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    I just thought the asset looks like this guy lol

    http://en.tintin.com/

    Do you have a youtube of the tutorial please? I cant understand anything other than youtube as im still unfamiliar with unity intreface. Also what's a decal? And do you have a script to make the lights flicker on and off :D
     
  41. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,481
    Are you even learning at this point? I'm sure you can figure out how to write a script to make a light flicker and you cant do everything from tutorials and learn the problem solve around new problems at the same time.
     
    iamthwee likes this.
  42. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    And here lies me, 6 years of experience with Unity; far from knowing everything.. ;)
     
    iamthwee likes this.
  43. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    Yeah you're right, I'll try and figure it out somehow, I don't know what I am learning now. I feel the only tutorials that went in was the ball roll and space shooter tutorial. I'm just throwing everything together to see if it works. What should I do, concentrate on gameplay or something... with just a cube?
     
    Last edited: Dec 12, 2015
  44. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,481
    they key isnt knowing it all, but know how to figure out what you need when needed.

    edit:
    @BrUnO XaVIeR also thanks to your profile pic think im going to be listening to Malmsteen and Buckethead for the rest of the day, and going back to considering myself a rubbish guitar player.
     
    Last edited: Dec 12, 2015
    iamthwee likes this.
  45. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    square1.jpg

    New Battle Plan


    Ok boys. New battle plan, I've abandoned my idea of making a horror island clone. What was I thinking. So a new battle plan is being forged. To prevent me from getting carried away with lighting and texturing, I've restricted myself to planes, cubes and spheres. Lightsource will be only one directional light - and a few points lights, all materials will be same color except the enemy which will be red.

    No scripts will be used from the standard asset pack, and I can use what I've learned from the ball roll tutorial and space shooter. Plan is to make a game, I've made, not someone else's or a video tutorial of someone else's game. Thanks to passerbycmc, it's finally sunk in ;)

    I'm starting with a pen and pad and logging off. Just need to hit the gym first, so be back in two hours or so with a progress update. (see attached idea)
     
    Last edited: Dec 12, 2015
    Haseeb_BSAA likes this.
  46. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    657
    You should try to understand how things work first. Programming is more about analysing your problem and cutting it into small pieces.
    For example, you say you want to make the light flicker. There are 2 options. Either make an animation where you change the light value on the light, or via scripting.
    In the script, you'll need to access the light's value. Which is a float. So you'll need a float variable to change over time. That means you may end up putting something in the Update loop and multiply it over time. You could use the Rand function to add the flicker. If you use "modulo", you can make it to only check the light for every few seconds.

    It's good that you are penning the game, as with that you can tell part of problems and needs you find in your game.
     
    RavenOfCode likes this.
  47. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    I don't know if this is good practice or efficient but I google and found this, it seems to work

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class LightController : MonoBehaviour {
    5.     public Light myLight;
    6.     // Use this for initialization
    7.     void Start ()
    8.    {
    9.        
    10.     }
    11.  
    12.     // Update is called once per frame
    13.     void Update ()
    14.     {
    15.  
    16.         if ( Random.value > 0.9 ) //a random chance
    17.         {
    18.             if ( myLight.enabled == true ) //if the light is on...
    19.             {
    20.                 myLight.enabled = false; //turn it off
    21.             }
    22.             else
    23.             {
    24.                 myLight.enabled = true; //turn it on
    25.             }
    26.         }
    27.     }
    28.  
    29.  
    30. }
     
    Last edited: Dec 12, 2015
  48. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,155
    LOL Jesus Christ boys this is like pulling teeth, I'm gonna be here for hours, not only is c# a terrible language, verbose beyond imagination, hardly any of the online resources are written for unity 5, practically every single snippet I look at is deprecated and only applicable for unity 4.

    Only the unity online documentation is good to go! farrrrrkkkkkkkkeirdkljd Arrrrrgh.
     
    Last edited: Dec 12, 2015
  49. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    657
    replace mylight.enabled=true; with mylight.SetActive(true);
    and mylight.enabled=false; with mylkght.SetActive(false);
    Being verbose is good i think, because it'll save you from future trouble when you'll be trying to hunt down mistakes.
    It's not letting anything at chance.
     
    Dantus likes this.
  50. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,481
    for the most part old learning content will still work, there arent that many exceptions, but the main one is, you have to explicity GetComponent for things like rigid body's now.

    Also i assume you dont have much programming experience, since yes C# is verbose, it it still less so than java or c++, and it holds its own, as powerful and easier to learn language.
     
    Dantus likes this.
Thread Status:
Not open for further replies.
unityunity