Search Unity

Discussion Transparent Cutout shader not load from AssetBundle

Discussion in 'Asset Bundles' started by vihresko, Jul 18, 2022.

  1. vihresko

    vihresko

    Joined:
    Apr 25, 2022
    Posts:
    2
    I create Quad with VideoPlayer component. Video Render mode is set to material-override and renderer is this Quad. The material of Quad is with shader Transparent Cutout.
    I make Prefab with this WholeObject. After that made AssetBundle from this Prefab.
    Put it on my local server.

    Then i use this script for loading that object:

    public class BundleWebLoader : MonoBehaviour
    {
    public GameObject target;
    private string bundleUrl = "http://localhost/assetbundles/myasset";

    IEnumerator Start()
    {
    using (UnityWebRequest request = UnityWebRequestAssetBundle.GetAssetBundle(bundleUrl))
    {
    yield return request.SendWebRequest();
    AssetBundle myLoadedAssetBundle = DownloadHandlerAssetBundle.GetContent(request);
    var augmentation = myLoadedAssetBundle.LoadAsset<GameObject>("quad");

    Instantiate(augmentation);
    };
    }
    }

    But i reseive only Pink Form of the Quad. With this error:
    Renderer "Quad(Clone)", targeted by VideoPlayer, has no material with a texture property.
    UnityEditor.VideoPlayerEditor:OnEnable ()

    HOW CAN RESOLVE IT?
    When i use Default-material for Quad(MeshRenderer) it works, but i want transparent video. Is it posible?

    p.p. When the object is created is Pink. Without stop the Unity, i reselect same shader in the Quad and the object start with the video. Why not start directly when its created?