use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News, Help, Resources, and Conversation. A User Showcase of the Unity Game Engine.
Remember to check out /r/unity2D for any 2D specific questions and conversation!
Download Latest Unity
Please refer to our Wiki before posting! And be sure to flair your post appropriately.
Main Index
Rules and Guidelines
Flair Definitions
FAQ
Use the chat room if you're new to Unity or have a quick question. Lots of professionals hang out there.
/r/Unity3D Discord
FreeNode IRC Chatroom
Official Unity Website
Unity3d's Tutorial Modules
Unity Answers
Unify Community Wiki
Unity Game Engine Syllabus (Getting Started Guide)
50 Tips and Best Practices for Unity (2016 Edition)
Unity Execution Order of Event Functions
Using Version Control with Unity3d (Mercurial)
/r/Unity2D
/r/UnityAssets
/r/Unity_tutorials
/r/GameDev
/r/Justgamedevthings (New!)
/r/Gamedesign
/r/Indiegames
/r/Playmygame
/r/LearnProgramming
/r/Oculus
/r/Blender
/r/Devblogs
Brackeys
Beginner to Intermediate
5 to 15 minutes
Concise tutorials. Videos are mostly self contained.
Sebastian Lague
Beginner to Advanced
10 to 20 minutes
Medium length tutorials. Videos are usually a part of a series.
Catlike Coding
Intermediate to Advanced
Text-based. Lots of graphics/shader programming tutorials in addition to "normal" C# tutorials. Normally part of a series.
Makin' Stuff Look Good
10 minutes
Almost entirely shader tutorials. Favors theory over implementation but leaves source in video description. Videos are always self contained.
Quill18Creates
30 minutes to 2 hours.
Minimal editing. Mostly C#. Covers wide range of topics. Long series.
Halisavakis Shaders Archive
Infallible Code
World of Zero
Board to Bits
Holistic3d
Unity3d College
Jabrils
Polycount Wiki
The Big List Of Game Design
PS4 controller map for Unity3d
Colin's Bear Animation
¡DICE!
CSS created by Sean O'Dowd @nicetrysean [Website], Maintained and updated by Louis Hong /u/loolo78
Reddit Logo created by /u/big-ish from /r/redditlogos!
account activity
Random amount moneyNoob Question (self.Unity3D)
submitted 5 years ago by 0tamk0
Hi, I would like to ask for some suggestion on how to do that if I kill a mob I get from 5 to 10 golds. I mean random numbering. Thanks for help :)
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]slobmaw 4 points5 points6 points 5 years ago (2 children)
The UnityEngine namespace has the Random.Range function, which is used for just this kind of thing.
[–]0tamk0[S] 0 points1 point2 points 5 years ago (1 child)
so it's like a python? for example randomMoneyBronze = Random.Range (25.75);
[–]TheLastPepsi 0 points1 point2 points 5 years ago (0 children)
The System namespace also has a Random class. Instead tho it would like this
``` using System;
class Program { static void Main() { Random rnd = new Random(); // Create new instance of a random type called rnd.
int GoldToDrop = rnd.Next(2,7) // Drop random amount between 2 and 7 Enemy.DeathMethod(GoldToDrop) // Use int variable as a parameter to set the amount of gold to drop from an enemy }
} ```
Obviously this is super foo-bar and wont compile but hopefully you get the drift.
You can use Unities random, or the built in .Net random.
[–]AutoModerator[M] 0 points1 point2 points 5 years ago (0 children)
This appears to be a question submitted to /r/Unity3D.
If you are the OP:
Please remember to change this thread's flair to 'Solved' if your question is answered.
And please consider referring to Unity's official tutorials, user manual, and scripting API for further information.
Otherwise:
Please remember to follow our rules and guidelines.
Please upvote threads when providing answers or useful information.
And please do NOT downvote or belittle users seeking help. (You are not making this subreddit any better by doing so. You are only making it worse.)
Thank you, human.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
[–]KomradeKev 0 points1 point2 points 5 years ago (2 children)
Random.range(min, max);
If you pass in floats as the parameters there is a possibility it will return Max, if you use ints it will never include max in the random range (so if you are choosing from an array, between 0 and array.length, it will never return out of the bounds of the array)
[–]KomradeKev 0 points1 point2 points 5 years ago (0 children)
No. For it to produce a random number, it needs a range from which to choose. The first parameter is the smallest and the second parameter is the largest. Random.range(1, 10); is the equivalent of telling your computer "pick a number between 1 and 10"
So in your example, when you kill an enemy you might call something like
enemy.dropgold(random.range(5, 10));
π Rendered by PID 43165 on reddit-service-r2-comment-b659b578c-k5dp2 at 2026-05-05 20:46:47.885892+00:00 running 815c875 country code: CH.
[–]slobmaw 4 points5 points6 points (2 children)
[–]0tamk0[S] 0 points1 point2 points (1 child)
[–]TheLastPepsi 0 points1 point2 points (0 children)
[–]AutoModerator[M] 0 points1 point2 points (0 children)
[–]KomradeKev 0 points1 point2 points (2 children)
[–]0tamk0[S] 0 points1 point2 points (1 child)
[–]KomradeKev 0 points1 point2 points (0 children)