Question assetbundle questions

Jiraiya

Well-known member
Messages
480
Reactions
999
Points
93
Hi, I am trying to import some assets from the unity store into VAM.
I got as far as creating an assetbundle but it has serious issues.
Apart from all the textures/materials being blank (it's all grey man!) the perspective is horribly broken and I don't know why.
If I view the room it looks huge, but if I put a model in , their feet touch the floor when I am up close, if I move away they look tiny inside a massive room.
The perspective is completely messed up, the room is the correct size, but doesn't look it.

Has anybody done the process of importing from unity assets to an assetbundle could help?
 
Here you go:

Regarding size, one unit in Unity is one meter in VaM. Some use assets use centimeters, so you have to scale by 1/100. More obscure stuff might use inch, feet or whatever imperial nonsense unit, but that's pretty rare as it is hard to work with when units don't line up nicely.
 
Upvote 0
Thanks for the reply! The scale isn't the issue. It's the "perspective/FoV" when I load it.
When I walk close to something it's the right size, but as I walk away it changes size and looks giant.
I had a long room. The girl at the far end looked tiny, like a little barbie doll floating in the middle of the room.
When I walked up to her she grew and the room shrunk so eventually when I was close, she was the right 1:1 size, stood on the floor with her head near the top.
It's a really weird effect and it's not the scale of the object that is wrong.
 
Upvote 0
Using Desktop Mode?
Maybe you messed with the Fov setting somehow?
1613302969080.png


Other than that it could be an issue with the settings in your Unity project. However, that should only affect the CustomAssetBundle not VaM characters. Usually you get issues like double vision. Anyway, make sure you got the right Unity setup:

You NEED to use Unity 2018.1.9f2, precisely that old version! Other than that you need to make sure to use the following settings for your Unity project:
  • Set project Color Space to Linear to get proper lighting. This is found in Edit->Project Settings->Player. Then click Other Settings tab. Set Color Space->Linear (default is Gamma)
  • Turn on VR support and set to single pass. This is found in Edit->Project Settings->Player. Then click XR Settings tab. Click Virtual Reality Support checkbox. The set Stereo Rendering Method->Single Pass.
If you use the project bundle that is part of my tutorial above, those two settings are already set.
 
Upvote 0
the VaM character was fine, it was just my asset that was going strange, so I don't think it was the FoV in VaM that was broken, something about the asset.
I really appreciate all the help! (AND you amazing scripts, that's some awesome work you have done.)
I am using 2018.4.30f because that was required for another project... If that is breaking things I might be screwed.

UPDATE-
Ok, so I made those changes to the lighting and ticking VR support (dammit, I missed that before) and it works now. The perspective is all back.
I still need to work on the textures/materials but at least the shape is right now.
I have a lot to learn, I want to import some robots and have them posable, maybe even animated. The models are rigged in unity but I don't know how that translates into VaM yet... Lot's to learn.
 
Last edited:
Upvote 0
I am using 2018.4.30f because that was required for another project... If that is breaking things I might be screwed.
That might be the reason why your materials don't work. You REALLY need that old Unity version, because VaM is using that version and can't load anything newer properly. However, you can easily have multiple versions of Unity installed....using Unity Hub manages that easily for you.

Note that you will need to make your own VaM custom plugins to control your Unity animations or do custom posing stuff.
 
Upvote 0
So I can't see that version in the unity hub. The one I have is the oldest offered as an LTS version.
Have you got a link to the one I need?
If it's as simple as just the wrong version I will be sort of happy, but annoyed too. Your last suggestions fixed my other issues so I assume you are right here too!

Nevermind, I found it in their archive. It's installing now.
Thanks again for the help.
 
Upvote 0
AAaaaaand It's working.

It took a bit to get all the right settings, but now I have actual colours in the assetbundle. Things look like they are supposed to!!!!

I can't thank you enough for the help. I had assumed I was doing something wrong not just using the wrong version of unity.
Meh. Stupid thing. Anyway, I have working assetbundles now thanks to you!
 
Upvote 0
Are there any tutorials on how to deal with joints? In theory I have a rigged posable figure imported in the assetbundle, but I have no clue how to actually move the parts once imported, I just get a statue.
 
Upvote 0
Yeah, I get that. I just have no clue where to start. I don't expect there are any guides on this particular bit as static assets are more normal.
Oh well, I will google the best I can.
 
Upvote 0
Ok, so I got as far as writing the script and loading it in, but I get an error,
"Your CUA is missing mandatory components ( transform name cube and sphere )."

Now I used your example script as the basis for loading in my custom assetbundle so that explains the name cube and sphere in the error, but I don't get what it means by missing components? I am referencing the names of objects in the bundle but it just doesn't work.
Is it better or worse if I just get a failed to init after 3600 instead of that missing components?

I am new to all of this so please be gentle with this idiot.
 
Upvote 0
Not sure what you mean by "your example script", it might be someone else's code? Are you trying to load the AssetBundle entirely by code without using a CustomUnityAsset atom? You can do that, but I would not recommend that to anyone new to VaM coding.

Anyway, I would just take a plain CustomUnityAsset and load your AssetBundle there, just like it would be a regular asset. Then you put a plugin on that atom that looks for the GameObject that was spawned. Just run the following from your plugin's Update() method. While the AssetBundle is still loading (or there is no or the wrong AssetBundle set) you get a null result. Eventually you get a GameObject and can do stuff with it.

C#:
private GameObject myPrefab;

private GameObject GetCustomUnityAsset(string prefabName)
{
    Transform t = containingAtom.reParentObject.Find("object/rescaleObject/"+prefabName+"(Clone)");
    if (t == null)
        return null;
    else
        return t.gameObject;
}

private void Update()
{
    if (myPrefab == null)
        myPrefab = GetCustomUnityAsset("NameOfMyFancyGameObjectInUnity");
    if (myPrefab == null)
        return;
        
    // do stuff with myPrefab here!
    
}
 
Upvote 0
Sorry, it was another example script found on here. Turns out my assetbundle has no renderer?
I can add the CUA and have it appear on screen, I can move it around manually and it all seems ok. However, the script complains there is no renderer. When I opened your tutorial zip and looked at the example sofa/ottoman indeed they had a "Mesh Renderer" inside the .fbx for the object that mine doesn't have.
I don't know why it isn't there on mine or how I get it!
 
Upvote 0
Note that I can't help you by magically guessing what you are trying to do with some example I don't know about.

You likely got a SkinnedMeshRenderer instead of a MeshRenderer, because you have a skinned/rigged mesh?
However, why would you need to access that?

In the Unity engine animations are controlled via the Animator component, which runs a controller graph. You probability should familiarize yourself with that before trying to get it into VaM.

Alternatively you could also control the bones directly, these will be exposed as child GameObjects below your GameObject that got the SkinnedMeshRenderer. You just need to set the position/rotation for these.
 
Upvote 0
Yes, I understand. Apologies for the confusion. I really do appreciate all the help here.
The main asset is in my scene as a prefab, That now has the following components attached,
Transform
Animator
Mesh Renderer

Now for the moment I don't want to do anything complex as you rightly point out I need to do a LOT of learning with Unity.
What I want to do right now is just move this asset around the scene, change it's rotation and x/y/z position etc from within the script.

I was trying to get something working from this example, https://hub.virtamate.com/resources/cua-editor-tutorial.2669/

I removed one of the objects and the color references and was hoping to just use the "turn off/on" button to verify the script works.
Once I have it able to turn the object off and on I can do a lot of looking into whats possible from there, but I can't even get that far.

If I can get to the point that I can move the object around the scene from the script I will be very happy, animation seems to be a long way off for me.
 
Upvote 0
Well, you get the GameObject as per above code, get the Transform on it (via .transform) and set the position and the rotation?

Code:
myPrefab.transform.position = new Vector3(1,2,3);
myPrefab.transform.rotation = Quaternion.Euler(45, 0, 0);
 
Upvote 0
Thank you again. The script as written didn't work, loads of errors, but I managed to mangle it with stuff from my other script and have cobbled together something that finally works!!!
THANK YOU!

I have a toggle that turns the asset on and off, that works perfectly.
I can change the rotation and position in the script but I am having issues reading the values of a slider back into the script. I guess I need to read loads of other peoples scripts to see how this is all done.

Anyway, I got the major milestone done. I have a working script that changes the asset as I want.
 
Upvote 0
Back
Top Bottom