Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by tkati · Sep 12, 2016 at 12:53 PM · c#scripting problem

Random.InitState

I'm having issues with using the Random.InitState(), keep getting Random does not have a definition for InitState.

I viewed previous comments that had similar messages... My class is scrGameManager and I'm not using a System.Random anywhere

I tried initializing a Random gameRdmNbrs but end up with the same errors so I'm at a loss, the documentation says there is a InitState function.....

Any suggestions?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Landern · Sep 12, 2016 at 12:58 PM 1
Share

Do you have:

 using System;

namespace import in the class?

Are you using a seed parameter to InitState as there isn't a parameterless InitState static function in UnityEngine.Random.InitState(someIntValueForSeed)?

Have you tried to fully qualify the namespace when invoking this static function?

 UnityEngine.Random.InitState(39834);

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by tkati · Sep 14, 2016 at 01:31 AM

I remember trying fully qualifying, same message, no not using using System because from my understanding that is using the non unity libraries, I was trying to use the Unity version, and from my understanding that uses UnityEngine which I had listed.

I read once upon a time that one might have to explicitedly type in a special command to avoid the system from getting confused/ can't find out what that was for the life of me, might be imagine things though too.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tkati · Sep 14, 2016 at 01:41 AM 0
Share

I guess it's not a huge deal because I have the System.Random working, maybe something has changed in the newer versions, I'm using 5.3.5f1 and reading 5.4 documentation so....

avatar image
0

Answer by glenneroo · Aug 06, 2018 at 02:29 AM

Do you mean?

 UnityEngine.Random.InitState(System.Environment.TickCount);
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to add a Type to a Class in Javascript? 1 Answer

increase score with a variable from another script 1 Answer

Generating random points and instantiating prefabs with a set distance 0 Answers

Script not working for me 2 Answers

How to set a variable of a non-monobehavior script from a monobehaviour script 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges