Playmaker Forum

PlayMaker News => General Discussion => Topic started by: PleaseHelpMe on August 19, 2018, 12:39:03 PM

Title: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: PleaseHelpMe on August 19, 2018, 12:39:03 PM
Hello, is there a Playmaker Action that can get the hash out of an AssetBundle manifest so AssetBundle versions can be confirmed and will update?
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: jeanfabre on August 21, 2018, 01:09:59 AM
Hi,

 uhm, interesting question, just made an action for this on the ecosystem called

GetAssetBundleHashIsValid

Can you confirm it works for you?

 Bye,

 Jean
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: PleaseHelpMe on August 22, 2018, 05:23:27 PM
Hi,

 uhm, interesting question, just made an action for this on the ecosystem called

GetAssetBundleHashIsValid

Can you confirm it works for you?

Hello, thank you for the quick script. However, I am receiving this error and it does not even appear inside "Actions" tab.

Assets/PlayMaker Custom Actions/AssetBundle/GetAssetBundleHash.cs(35,40): error CS0120: An object reference is required to access non-static member `UnityEngine.AssetBundleManifest.GetAssetBundleHash(string)'

Your written code for line 35 is:
Code: [Select]
Hash128 _hash = AssetBundleManifest.GetAssetBundleHash (assetBundleName.Value);
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: jeanfabre on August 23, 2018, 12:02:27 AM
Hi,

 ah, crap, I need to dive into Bundle properly on this one.

 Where is located your bundle? is online or inside a mobile app?

 Bye,

 Jean
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: PleaseHelpMe on August 23, 2018, 12:58:27 AM
Hi,

 ah, crap, I need to dive into Bundle properly on this one.

 Where is located your bundle? is online or inside a mobile app?

Hello, the Bundles are located online. I am using the "W W W Asset Bundle" to call the bundle and caching the bundle.
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: jeanfabre on August 23, 2018, 01:43:25 AM
Hi,

 ok, so do you want to download the manifest first and verify the hash or do you want to download the bundle and then check the manifest?

are you on 2017 and/or 2018? or 5.x?

 Bye,

 Jean
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: PleaseHelpMe on August 23, 2018, 01:53:07 AM
Hi,

 ok, so do you want to download the manifest first and verify the hash or do you want to download the bundle and then check the manifest?

are you on 2017 and/or 2018? or 5.x?

Hello, I want it to download the manifest first since the manifest is only 1KB and it will be downloaded from the internet immediately everytime the app is launched. Thus, allowing for all other scenes that require to be updated to download immediately after that.

I am on 2018.
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: jeanfabre on August 23, 2018, 07:40:49 AM
Hi,

 ok, I was trying with 5.6, and was hitting trouble, I'll try on 2017 an 2018, maybe it will work straight off.


Bye,

 Jean
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: PleaseHelpMe on August 23, 2018, 07:41:59 PM
Hi,

 ok, I was trying with 5.6, and was hitting trouble, I'll try on 2017 an 2018, maybe it will work straight off.

Hello again, I've also been trying to figure out how to delete Version "1" of a cached AssetBundle so I can replace Version "1" with an updated cached AssetBundle from the internet. Because the current method is to keep incrementing the Version "#" integer from 1 to 2 to 3, etc. everytime there is an update.

So if the AssetBundle is updated to Version "2", then the Version "1" is still cached and is taking up storage space.

So on "W W W Asset Bundle" there exists a bool "Load From Cache or Download" and an integer "Cache Version "#"".
Is it possible to create an "Override Cache" and "Cache Version "#"" as well. That will override a Cached AssetBundle with the new AssetBundle? This way, it can stick to Version "1" and only have 1 AssetBundle Version Cached instead of multiple versions cached?
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: jeanfabre on August 24, 2018, 01:35:59 AM
Hi,

 ok, after some discussion on the unity forum, it turns out that I am failing to produce a valid asset bundle... I am puzzled as to why, but I have to investigate further.

 but I think I fixed the action to get the hash and checkj if it is valid, can you get it again from the ecosystem:

 you first load the assetbundle into an FmsObject and use that within the action GetAssetBundleHashIsValid action.

 It's blind coding since I don't have any working assetbundle.

 maybe you could share with me your url, and give me the assetBundleName, then I can try.

 Let me know how it goes,

 we'll get to the versionning after.

 BYe,

 Jean
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: PleaseHelpMe on August 24, 2018, 05:52:24 AM
Hi,

 ok, after some discussion on the unity forum, it turns out that I am failing to produce a valid asset bundle... I am puzzled as to why, but I have to investigate further.

 but I think I fixed the action to get the hash and checkj if it is valid, can you get it again from the ecosystem:

 you first load the assetbundle into an FmsObject and use that within the action GetAssetBundleHashIsValid action.

 It's blind coding since I don't have any working assetbundle.

 maybe you could share with me your url, and give me the assetBundleName, then I can try.

 Let me know how it goes,

 we'll get to the versionning after.
It doesn't seem like I'm doing this correctly. For "Asset Bundle" should I be loading in the Saved Variable Object of the AssetBundle I want to be loading and for "Asset Bundle Name" I should be typing in the name of the Manifest?

I am uploading 2 sets of the same AssetBundles with different builds so you can test it.

The 1st set of AssetBundles uploaded below will display a text saying "Version 1".
Code: [Select]
Manifest file, called "Android" since it is built for Android
https://www.dropbox.com/s/ifi40dkepafej9j/Android?dl=1

Scene file, called "test1" will display text "Version 1"
https://www.dropbox.com/s/tflc26qfy0xdzxu/test1?dl=1

The 2nd set of AssetBundles uploaded below will display a text saying "Version 2".
Code: [Select]
Manifest file, called "Android" since it is built for Android
https://www.dropbox.com/s/umvfkh1psbvcymq/Android?dl=1

Scene file, called "test1" will display text "Version 2"
https://www.dropbox.com/s/ufkp2y0gemwerqj/test1?dl=1
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: jeanfabre on August 26, 2018, 11:51:39 PM
Hi,
 
you need to load the assetbundle itself, not the file with the extension .manifest.

 yes, you save it in the assetbundle FsmVariable and use it in the action to get the hash is valid flag.


which version of Unity did you use to produce these asset bundles?


Bye,

 Jean
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: PleaseHelpMe on August 27, 2018, 01:36:42 AM
Hi,
 
you need to load the assetbundle itself, not the file with the extension .manifest.

 yes, you save it in the assetbundle FsmVariable and use it in the action to get the hash is valid flag.


which version of Unity did you use to produce these asset bundles?

Hello, I uploaded the assetbundles using 2018. The Android Manifest file I uploaded is the correct file. I did NOT upload the Android.Manifest file. I uploaded the Android no extension file.

The assetbundle build for android will still work with other platforms. Just some objects will lose texture and become purple.
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: tcmeric on August 27, 2018, 04:55:37 AM
Hi, just to throw it out there. Here are my asset bundle actions, that are confirmed working. The require unity 5.3 and higher.

https://github.com/dumbgamedev/playmaker_assetbundle

It does not have the hash action however.
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: jeanfabre on August 28, 2018, 12:30:54 AM
Hi Eric,

 Could you validate that the hash is valid actions works for you?

 Bye,

 Jean
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: PleaseHelpMe on August 28, 2018, 11:34:11 AM
Could you validate that the hash is valid actions works for you?
Please refer to the picture on my steps to reproduce this.
On the top picture I am using "Android" and "test1" (both from set 1) and it returns isValue bool=true as it should.

However, now refer to the bottom picture. The URLs are enlarged to show the Manifest URL is still the same for both tries, however the "test1" url is now different since it is using a new "test1" asset bundle build.

The 2nd picture I am using "Android" (from set 1) and "test1" (from set 2) and it still returns isValue bool=true. Which should be false.

I also made sure to delete all of my Downloaded AssetBundle caches before going the 2nd time so it would download the new "test1" from set 2.

If I am doing the states wrong. Please correct.
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: jeanfabre on August 28, 2018, 11:29:28 PM
Hi,

 well... I am myself unable to get to the bottom of this currently, something is odd in the way assetbundle needs to be handled, and it seems something either very obvious or totally buggy ( I think the former),

So I don't know what is the right approach to check for hash is valid, and on the unity forum, I haven't found any extensive documentation on this, I only have this ( from where his bundle works actually, I can get to the manifest, but I don't know his bundlename so I can't test for isvalid)

https://forum.unity.com/threads/how-to-get-assetbundlemanifest.495494/#post-3607006

Bye,

 Jean
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: PleaseHelpMe on August 29, 2018, 01:02:58 AM
Hi,

 well... I am myself unable to get to the bottom of this currently, something is odd in the way assetbundle needs to be handled, and it seems something either very obvious or totally buggy ( I think the former),

So I don't know what is the right approach to check for hash is valid, and on the unity forum, I haven't found any extensive documentation on this, I only have this ( from where his bundle works actually, I can get to the manifest, but I don't know his bundlename so I can't test for isvalid)

https://forum.unity.com/threads/how-to-get-assetbundlemanifest.495494/#post-3607006

Hello, I have gone with a variable approach where the game always downloads a tiny assetbundle about 10KB. This AssetBundle contains a scene with a "version" variable, that is increased if a new update is available. The game then pulls the current "version" variable from playerprefs and compares it. Then it does a true/false statement whether to download or load from cache. This basically does the same thing. Just not as elegant.

Do you think it's possible to do what we talked about earlier?

About when there is an update available, it will delete the cached asset and download and cache the new one in the same Version # instead of incrementing the Version # which still keeps the previous caches and takes up storage space.

Or is it hard for you to do since you are not able to access assetbundles on your end?
Title: Re: Is there a Playmaker action that can get hash out of AssetBundle manifest?
Post by: jeanfabre on August 29, 2018, 11:03:56 PM
Hi,

 I am getting lost of the thread, it would be good to have a dedicated thread for each of the thing you want to do with assetbbundle.

 but yeah, right now working with the manifest seems odd, and I haven't fully grasp how it works unfortunatly, as it seems to require some kind of voodoo I haven't figured out yet.

 as for the versioning, have you checked with Eric ( tmeric forum member), he provided some proper support for assetbundle, maybe he has already what you need covered.

 Bye,

 Jean