hi all,
I am trying read file in iOS folder but it failed.
in xcode , i let my ipad to download file and save it
like this
//download in xcode
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSArray *pathLis = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [pathLis objectAtIndex:0];
path = [path stringByAppendingPathComponent: @"aaa.unity3D"];
if([tempData writeToFile:path atomically:NO])
{
NSLog(@"YES");
}
else
{
NSLog(@"NO");
}
NSLog(@"save as %@", path);
//[tempData release];
//tempData = nil;
}
this works fine , download is ok , saving file is ok,too.
but when i want to load the file in unity.
it failed.
in unity i try this command
Resources.LoadAssetAtPath( Application.persistentDataPath+“/aaa.unity3D”);
or
WWW bundle = new WWW(file://+Application.persistentDataPath+“/aaa.unity3D”);
etc…
i try any path i find in web
and i sure the path is right.
because this works great in uinty
FileStream fs = new FileStream(Application.persistentDataPath+“/aaa.unity3D”, FileMode.Open, FileAccess.Read);
why?
the FileStream is byte
i don’t know how to change to prefab or other type i wnat to use in unity.
C# “filestream” can read the file in iOS
but “Resources.LoadAssetAtPath” fail
and the path is 100% same
Anyone know about this?
or how can i change byte to unity object?
Sorry for my bad english~