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
0
Question by Honour-Demon · Apr 29, 2016 at 06:27 AM · unity 5errorsystem.io

File.GreateText Unity 5.1.2 to 5.3.4 upgrade lols

Could some one please explain why this method is suddenly broken between the 2 builds?

Additionally some pointers on how to avoid this sort of upgrade nightmare would be nice :D

"Is there a new Way of doing this?"

I am simply creating a text document and storing one line of data into it. But as of now the text file isn't even being "created" :/. Never had this issue before either.

Please don't get hangup on the UMA part. This is in no way an UMA related error, unless I'm blind. It's creating a text file prob, Period

Some more Infos: Upgraded win 7 to win7 sp1. {Was still working fine in Unity 5.1.2f} Using encryption {Yes, this has never been a problem before, never. And it shouldn't, in the first place}.

The Error:

DirectoryNotFoundException: Could not find a part of the path "D:\Unity\Drudgery-Man\Resources\BaseCharacter\noob.txt". System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:292) System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare) System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/StreamWriter.cs:124) System.IO.StreamWriter..ctor (System.String path, Boolean append) (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool) System.IO.File.CreateText (System.String path) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:159) UMACharacterCreator.Save (System.String characterName) (at Assets/Scripts/GameManagers/UMACharacterCreator.cs:285) UMACharacterCreator.SaveLoad (Boolean salo) (at Assets/Scripts/GameManagers/UMACharacterCreator.cs:271) UnityEngine.Events.InvokableCall`1[System.Boolean].Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:175) UnityEngine.Events.CachedInvokableCall`1[System.Boolean].Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:293) UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:621) UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:756) UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:53) UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:35) UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:44) UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:52) UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:269) UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1) TeamUtility.IO.StandaloneInputModule:ProcessMousePress(MouseButtonEventData) (at Assets/InputManager/Addons/UIInputModules/StandaloneInputModule.cs:394) TeamUtility.IO.StandaloneInputModule:ProcessMouseEvent() (at Assets/InputManager/Addons/UIInputModules/StandaloneInputModule.cs:285) TeamUtility.IO.StandaloneInputModule:Process() (at Assets/InputManager/Addons/UIInputModules/StandaloneInputModule.cs:192) UnityEngine.EventSystems.EventSystem:Update()

The Code: "characterName" variable/parameter not important. Trimmed down a lot since getting this error.

 public void SaveLoad(bool salo){
     if(saveTarget.text == ""){
         Debug.Log("Please Enter a Character Name, or Family referance"); //see enums.CS for details
         return;
     }
     if (salo){
         Load(saveTarget.text as string);
     } else if(!salo){
         Save(saveTarget.text as string);
     }
 }
 
 /// Load and Save    
 public void Save(string characterName) {
     //Generate UMA String
     UMATextRecipe recipe = ScriptableObject.CreateInstance<UMATextRecipe>();
     recipe.Save(umaAvatar.umaData.umaRecipe, umaAvatar.context);
     SaveString = recipe.recipeString;
     Destroy(recipe);
     Debug.Log("Recipy is string");
     //Save string to text File
     string fileName = "Resources/BaseCharacter/noob.txt";
     StreamWriter stream = File.CreateText(fileName);
     stream.WriteLine(SaveString);
     stream.Close();
 }


Many Thanks in advance :D

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 Honour-Demon · Apr 29, 2016 at 09:14 PM

 string fileName = "D:/Unity/Drudgery-Man/Assets/Resources/BaseCharacter/noob.txt";

To be Honest, I hate answering my own q's. The above snippet of code does the trick.

Even though it seems unity would normally auto complete or know where to find the resources folder on it's own, you would now have to use the entire path to make things happen.

  string fileName = "Resources/BaseCharacter/noob.txt";

Old Code For convenience.

Any how, so if your having the same prob in newer versions of unity like this one, then hopefully I did help xD.

Another thought. I do know the technical details behind why this is happening. Could be .net related or what ever. So if any one wants to add on for the technical side. Please Do :)

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

88 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

ComponentChunkIterator is not liking me.. 0 Answers

Missing the class attribute 'ExtensionOfNativeClass' 4 Answers

Error : Failed to build apk -1 Answers

how to fix automatic camera rotation when using joysticks? 0 Answers

InvalidOperationException: Collection was modified; enumeration operation may not execute. 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