Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by azerbijon123 · Jan 24, 2013 at 10:02 PM · areaunlock

Make an area that is only accessible through buying a game addon?

So basically, I am quite new to scripting and I REALLY need some hints and tips here guys. I want to make an area of my map blocked off, until say... They purchase the addon which unlocks the next area... How would I go about doing this... I was thinking if anyone new any codes that would check a directory for a file and if it's there it will remove the invisible barrier and allow access through the city? I'm sure this is a much asked question for people who have just started, so please reply fast.

OUTLINE OF WHAT I NEED/IDEA

Help with writing a script that will check the system directory... (eg. C:\Users\Desktop\Addon.dll, Obviously I can encrypt the DLL file so you can't just make it yourself) and then if that file exists and contains a certain text inside... Then a gameobject that will be blocking the way (or multiple game objects) will then allow access.

CAN ANYONE HELP ME?!

So far I have this for my checking of the file code...

 function Start () {
 
 }
 
 function Update () {
     
     if (System.IO.File.Exists("D:\Addon\AddonCheck.txt")) {
     
     //Remove or disable gameObject. THIS IS WHAT I DON'T KNOW HOW TO DO.
     
     }
 
 }

Also this only checks if the file exists, not if the file has a certain string in it. I need it to check the file and see if it contains the string of say... "addon 1.1 = true" And if it says this then it will unlock a certain gameObject allowing the player to walk through...

May I add that the text file will be able to contain different addons if they have more than one... So it should check for all of them...

Thanks! -Aaron

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by dorpeleg · Jan 24, 2013 at 10:24 PM

Here is an example I found on the forums:

http://forum.unity3d.com/threads/99427-Step-by-step-tutorial-for-c-.net-dll-and-Unity3D(Pro-only).

It states there how to load the dll and access functions inside it.

I think that is what you are looking for.

After checking if the file in there, load it, then use some function to make sure this is your real addon file.

Comment
Add comment · Show 11 · 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 azerbijon123 · Jan 24, 2013 at 10:42 PM 0
Share

Thanks for this!:) The only problem is, now I have this in my project, do you know of any functions to remove or disable a game object?

avatar image dorpeleg · Jan 24, 2013 at 10:54 PM 0
Share

Disabling an object is easy.

Just use gameobject.active = false;

This is not done inside the dll.

In the dll you need to make up your own function that will eventually return true or false (this is just an example) of if the addon is genuine or not.

In the example shown in the link, he is creating a function to return a string.

I'm not sure how to build a function to check if the addon is genuine or not, but in unity you should run the function and if it returns true (addon is genuine) then use the code I mentioned above.

avatar image azerbijon123 · Jan 24, 2013 at 11:11 PM 0
Share

Cheers man, do you have skype where I can quick chat you? Just to make it easier... I want to show you my code in more detail and it's faster than on here?

azerbijon123 (Add me)

avatar image azerbijon123 · Sep 04, 2013 at 10:05 PM 0
Share

Hey Dorpeleg! Please add me on Skype again! aarongregory97

avatar image azerbijon123 · Oct 29, 2015 at 04:45 PM 0
Share

Hello dorpeleg! Remember me?!

avatar image dorpeleg azerbijon123 · Oct 29, 2015 at 06:30 PM 0
Share

sure, sup? you can still reach me on the same skype account if you want

avatar image azerbijon123 dorpeleg · Oct 29, 2015 at 10:06 PM 0
Share

Not much man you? I don't have Skype anymore, but I can add you on S$$anonymous$$m if you have it?

Show more comments
Show more comments
Show more comments

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

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Variable doesn't change when box hit trigger area 3 Answers

How to Stop running after a few Seconds ? 1 Answer

How can i create anouther jump script? 0 Answers

i need some code suggestions 1 Answer


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