i tried it and it does work but only at the present sceneIf you assign all the assets to one parent atom and add the colorscale plugin to it, the parented assets will scale with it. The issue it that the objects positions scale relative to the object too, so unless you are scaling the whole environment, they will move away from where you have them placed.
![]()
ColorScale - Plugins + Scripts -
Attach the plugin (ColorScaleC inside the var package) to a CustomUnityAsset atom to be able to change color/scale on individual components. Coloring is optional in this plugin and disabled by default but can be enabled. For a more feature rich...hub.virtamate.com
thank you but its not what i need, i need a way to scale multiple assets at ones.Please, search the forums before posting, there's a thread for Editing CUA answered a day ago.
![]()
DLUtils - Plugins + Scripts -
Basically this plugin gives some abilities from Unity Editor. Add plugin to builtin asset or CUA or Light, change parameters as you want. DLUtils plugin can: Edit builtin assets or CUA: - turn off All GameObjects - turn off All...hub.virtamate.com
Sorry about that. It's something I noticed this plugin does by accident when I scaled a parent atom. I did test a scene with a few different asset types before I posted and it reloaded the save fine for me. I didn't restart Vam, so maybe it's a session thing? You may have to do it the hard way.i tried it and it does work but only at the present scene
one saved and reloaded everything gets reset to original size my scene got all messed up![]()
i was hoping to avoid thatSorry about that. It's something I noticed this plugin does by accident when I scaled a parent atom. I did test a scene with a few different asset types before I posted and it reloaded the save fine for me. I didn't restart Vam, so maybe it's a session thing? You may have to do it the hard way.
yes sorry if i didn't explain it right, color scale plugin that Origin69 suggested really does what i want but after scene load every atom gets reset to original scale.I'm realizing that in reality you're asking to scale multiple CustomUnityAssets, but MULTIPLE ATOMS, right?
yes sorry if i didn't explain it right, color scale plugin that Origin69 suggested really does what i want but after scene load every atom gets reset to original scale.
i think it was about 4 with color scaleAre you trying to push the asset sizes like crazy nuts or is a somewhat standard 0.5/2/3 times scale?
3 or 4, i'm trying to make a scene with size differences but since scaling person atom lower than 0.300 causes issues i thought to scale up the other person.And with the normal scale slider in the CUA, what would be the size you're aiming for?
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.XR;
using UnityEngine.Events;
using System;
using System.Collections;
using System.Collections.Generic;
using SimpleJSON;
using System.Linq;
using System.IO;
// MultiCUARescaler v1.0 - hazmhox
//
// Allows you to rescale all CUAs at once
namespace MultiCUARescalerPlugin
{
public class MultiCUARescaler : MVRScript
{
// Statics
private static string PLUGIN_NAME = "Multi CUA Rescaler";
protected List<JSONStorableFloat> allCuaSliders = new List<JSONStorableFloat>();
protected List<UIDynamicSlider> allCuaSlidersUI = new List<UIDynamicSlider>();
protected bool _isSceneLoading { get { return SuperController.singleton.isLoading; } }
public bool isSceneFrozen { get { return SuperController.singleton.freezeAnimation; } }
public bool isInEditMode { get { return SuperController.singleton.gameMode == SuperController.GameMode.Edit; } }
public override void Init()
{
try
{
if (containingAtom.type != "SessionPluginManager")
{
SuperController.singleton.Alert("<b><color=green>"+PLUGIN_NAME+"</color></b>\nSession plugin.\nPlease add it in your session plugins.", () => {});
return;
}
CreateStaticDescriptionText("Title","<color=#000><size=35><b>" + PLUGIN_NAME + "</b>\nThe plugin can rescale all CUA, it's a session plugin and does not save data. It will simply update the CUA scale in the scene</size></color>",true,250,TextAnchor.MiddleLeft);
OnSceneLoaded();
}
catch(Exception e)
{
logError(PLUGIN_NAME + " - Exception caught: " + e);
}
}
void Start()
{
}
void ClearUI()
{
foreach (UIDynamicSlider uids in allCuaSlidersUI)
{
RemoveSlider(uids);
}
allCuaSlidersUI.Clear();
allCuaSliders.Clear();
}
private void OnEnable()
{
SuperController.singleton.onSceneLoadedHandlers += OnSceneLoaded;
}
private void OnDisable()
{
SuperController.singleton.onSceneLoadedHandlers -= OnSceneLoaded;
}
// **************************
// Callbacks
// **************************
private void OnSceneLoaded()
{
ClearUI();
UIDynamicSlider tmpSlider;
foreach (Atom at in SuperController.singleton.GetAtoms())
{
if (at.type == "CustomUnityAsset")
{
JSONStorable scaleVal = at.GetStorableByID("scale");
JSONStorableFloat cuaSizeElem = new JSONStorableFloat(at.name + "_resize", scaleVal.GetFloatParamValue("scale"), 0f, 10f){isStorable=false,isRestorable=false};
cuaSizeElem.setCallbackFunction += (val) => { OnChangeCUASize(at, val); };
tmpSlider = CreateSlider(cuaSizeElem, false);
tmpSlider.valueFormat = "F2";
tmpSlider.label = at.name + " Scale";
allCuaSliders.Add(cuaSizeElem);
allCuaSlidersUI.Add(tmpSlider);
}
}
JSONStorableFloat cuaSizeAll = new JSONStorableFloat("all_resize", 1f, 0f, 10f){isStorable=false,isRestorable=false};
cuaSizeAll.setCallbackFunction += (val) => { OnChangeCUAAllSizes(val); };
tmpSlider = CreateSlider(cuaSizeAll, true);
tmpSlider.valueFormat = "F2";
tmpSlider.label = "Change all CUA Scale";
allCuaSlidersUI.Add(tmpSlider);
}
private void OnChangeCUASize(Atom at, float val)
{
at.GetStorableByID("scale").SetFloatParamValue("scale", val);
}
private void OnChangeCUAAllSizes(float value)
{
foreach (JSONStorableFloat jsf in allCuaSliders)
{
jsf.val = value;
}
}
// **************************
// Time to cleanup !
// **************************
void OnDestroy() {
}
// **************************
// Local Tools
// **************************
private void logDebug( string debugText ) {
SuperController.LogMessage( debugText );
}
private void logError( string debugText ) {
SuperController.LogError( debugText );
}
public UIDynamicTextField CreateStaticDescriptionText(string DescTitle, string DescText, bool rightSide, int fieldHeight, TextAnchor textAlignment = TextAnchor.UpperLeft, bool disableBackground = true, bool disableScroll = true ) {
JSONStorableString staticDescString = new JSONStorableString(DescTitle,DescText) {isStorable=false,isRestorable=false};
staticDescString.hidden = true;
UIDynamicTextField staticDescStringField = CreateTextField(staticDescString, rightSide);
if( disableBackground ) staticDescStringField.backgroundColor = new Color(1f, 1f, 1f, 0f);
staticDescStringField.UItext.alignment = textAlignment;
LayoutElement sdsfLayout = staticDescStringField.GetComponent<LayoutElement>();
sdsfLayout.preferredHeight = sdsfLayout.minHeight = fieldHeight;
staticDescStringField.height = fieldHeight;
if( disableScroll ) DisableScrollOnText(staticDescStringField);
return staticDescStringField;
}
public static void DisableScrollOnText(UIDynamicTextField target) {
// THIS is important, it's a "useless" temporary canvas group that will prevent the event from the mousewheel
CanvasGroup tmpCG = target.UItext.transform.parent.transform.parent.transform.parent.gameObject.AddComponent<CanvasGroup>();
tmpCG.blocksRaycasts = false;
ScrollRect targetSR = target.UItext.transform.parent.transform.parent.transform.parent.GetComponent<ScrollRect>();
if( targetSR != null ) {
targetSR.horizontal = false;
targetSR.vertical = false;
}
}
}
}
thank you so much that is perfectHere you go, just copy the code below in a text file. Rename the text file and change its extension to something like "multi_cua_rescaler.cs", put it in your Scripts folder and load it as a session plugin.
View attachment 559941
C#:using UnityEngine; using UnityEngine.UI; using UnityEngine.XR; using UnityEngine.Events; using System; using System.Collections; using System.Collections.Generic; using SimpleJSON; using System.Linq; using System.IO; // MultiCUARescaler v1.0 - hazmhox // // Allows you to rescale all CUAs at once namespace MultiCUARescalerPlugin { public class MultiCUARescaler : MVRScript { // Statics private static string PLUGIN_NAME = "Multi CUA Rescaler"; protected List<JSONStorableFloat> allCuaSliders = new List<JSONStorableFloat>(); protected List<UIDynamicSlider> allCuaSlidersUI = new List<UIDynamicSlider>(); protected bool _isSceneLoading { get { return SuperController.singleton.isLoading; } } public bool isSceneFrozen { get { return SuperController.singleton.freezeAnimation; } } public bool isInEditMode { get { return SuperController.singleton.gameMode == SuperController.GameMode.Edit; } } public override void Init() { try { if (containingAtom.type != "SessionPluginManager") { SuperController.singleton.Alert("<b><color=green>"+PLUGIN_NAME+"</color></b>\nSession plugin.\nPlease add it in your session plugins.", () => {}); return; } CreateStaticDescriptionText("Title","<color=#000><size=35><b>" + PLUGIN_NAME + "</b>\nThe plugin can rescale all CUA, it's a session plugin and does not save data. It will simply update the CUA scale in the scene</size></color>",true,250,TextAnchor.MiddleLeft); OnSceneLoaded(); } catch(Exception e) { logError(PLUGIN_NAME + " - Exception caught: " + e); } } void Start() { } void ClearUI() { foreach (UIDynamicSlider uids in allCuaSlidersUI) { RemoveSlider(uids); } allCuaSlidersUI.Clear(); allCuaSliders.Clear(); } private void OnEnable() { SuperController.singleton.onSceneLoadedHandlers += OnSceneLoaded; } private void OnDisable() { SuperController.singleton.onSceneLoadedHandlers -= OnSceneLoaded; } // ************************** // Callbacks // ************************** private void OnSceneLoaded() { ClearUI(); UIDynamicSlider tmpSlider; foreach (Atom at in SuperController.singleton.GetAtoms()) { if (at.type == "CustomUnityAsset") { JSONStorable scaleVal = at.GetStorableByID("scale"); JSONStorableFloat cuaSizeElem = new JSONStorableFloat(at.name + "_resize", scaleVal.GetFloatParamValue("scale"), 0f, 10f){isStorable=false,isRestorable=false}; cuaSizeElem.setCallbackFunction += (val) => { OnChangeCUASize(at, val); }; tmpSlider = CreateSlider(cuaSizeElem, false); tmpSlider.valueFormat = "F2"; tmpSlider.label = at.name + " Scale"; allCuaSliders.Add(cuaSizeElem); allCuaSlidersUI.Add(tmpSlider); } } JSONStorableFloat cuaSizeAll = new JSONStorableFloat("all_resize", 1f, 0f, 10f){isStorable=false,isRestorable=false}; cuaSizeAll.setCallbackFunction += (val) => { OnChangeCUAAllSizes(val); }; tmpSlider = CreateSlider(cuaSizeAll, true); tmpSlider.valueFormat = "F2"; tmpSlider.label = "Change all CUA Scale"; allCuaSlidersUI.Add(tmpSlider); } private void OnChangeCUASize(Atom at, float val) { at.GetStorableByID("scale").SetFloatParamValue("scale", val); } private void OnChangeCUAAllSizes(float value) { foreach (JSONStorableFloat jsf in allCuaSliders) { jsf.val = value; } } // ************************** // Time to cleanup ! // ************************** void OnDestroy() { } // ************************** // Local Tools // ************************** private void logDebug( string debugText ) { SuperController.LogMessage( debugText ); } private void logError( string debugText ) { SuperController.LogError( debugText ); } public UIDynamicTextField CreateStaticDescriptionText(string DescTitle, string DescText, bool rightSide, int fieldHeight, TextAnchor textAlignment = TextAnchor.UpperLeft, bool disableBackground = true, bool disableScroll = true ) { JSONStorableString staticDescString = new JSONStorableString(DescTitle,DescText) {isStorable=false,isRestorable=false}; staticDescString.hidden = true; UIDynamicTextField staticDescStringField = CreateTextField(staticDescString, rightSide); if( disableBackground ) staticDescStringField.backgroundColor = new Color(1f, 1f, 1f, 0f); staticDescStringField.UItext.alignment = textAlignment; LayoutElement sdsfLayout = staticDescStringField.GetComponent<LayoutElement>(); sdsfLayout.preferredHeight = sdsfLayout.minHeight = fieldHeight; staticDescStringField.height = fieldHeight; if( disableScroll ) DisableScrollOnText(staticDescStringField); return staticDescStringField; } public static void DisableScrollOnText(UIDynamicTextField target) { // THIS is important, it's a "useless" temporary canvas group that will prevent the event from the mousewheel CanvasGroup tmpCG = target.UItext.transform.parent.transform.parent.transform.parent.gameObject.AddComponent<CanvasGroup>(); tmpCG.blocksRaycasts = false; ScrollRect targetSR = target.UItext.transform.parent.transform.parent.transform.parent.GetComponent<ScrollRect>(); if( targetSR != null ) { targetSR.horizontal = false; targetSR.vertical = false; } } } }
hey hazmhox, is it maybe possible to set it so the code can scale the atoms like colorscale does?Here you go, just copy the code below in a text file. Rename the text file and change its extension to something like "multi_cua_rescaler.cs", put it in your Scripts folder and load it as a session plugin.
View attachment 559941
C#:using UnityEngine; using UnityEngine.UI; using UnityEngine.XR; using UnityEngine.Events; using System; using System.Collections; using System.Collections.Generic; using SimpleJSON; using System.Linq; using System.IO; // MultiCUARescaler v1.0 - hazmhox // // Allows you to rescale all CUAs at once namespace MultiCUARescalerPlugin { public class MultiCUARescaler : MVRScript { // Statics private static string PLUGIN_NAME = "Multi CUA Rescaler"; protected List<JSONStorableFloat> allCuaSliders = new List<JSONStorableFloat>(); protected List<UIDynamicSlider> allCuaSlidersUI = new List<UIDynamicSlider>(); protected bool _isSceneLoading { get { return SuperController.singleton.isLoading; } } public bool isSceneFrozen { get { return SuperController.singleton.freezeAnimation; } } public bool isInEditMode { get { return SuperController.singleton.gameMode == SuperController.GameMode.Edit; } } public override void Init() { try { if (containingAtom.type != "SessionPluginManager") { SuperController.singleton.Alert("<b><color=green>"+PLUGIN_NAME+"</color></b>\nSession plugin.\nPlease add it in your session plugins.", () => {}); return; } CreateStaticDescriptionText("Title","<color=#000><size=35><b>" + PLUGIN_NAME + "</b>\nThe plugin can rescale all CUA, it's a session plugin and does not save data. It will simply update the CUA scale in the scene</size></color>",true,250,TextAnchor.MiddleLeft); OnSceneLoaded(); } catch(Exception e) { logError(PLUGIN_NAME + " - Exception caught: " + e); } } void Start() { } void ClearUI() { foreach (UIDynamicSlider uids in allCuaSlidersUI) { RemoveSlider(uids); } allCuaSlidersUI.Clear(); allCuaSliders.Clear(); } private void OnEnable() { SuperController.singleton.onSceneLoadedHandlers += OnSceneLoaded; } private void OnDisable() { SuperController.singleton.onSceneLoadedHandlers -= OnSceneLoaded; } // ************************** // Callbacks // ************************** private void OnSceneLoaded() { ClearUI(); UIDynamicSlider tmpSlider; foreach (Atom at in SuperController.singleton.GetAtoms()) { if (at.type == "CustomUnityAsset") { JSONStorable scaleVal = at.GetStorableByID("scale"); JSONStorableFloat cuaSizeElem = new JSONStorableFloat(at.name + "_resize", scaleVal.GetFloatParamValue("scale"), 0f, 10f){isStorable=false,isRestorable=false}; cuaSizeElem.setCallbackFunction += (val) => { OnChangeCUASize(at, val); }; tmpSlider = CreateSlider(cuaSizeElem, false); tmpSlider.valueFormat = "F2"; tmpSlider.label = at.name + " Scale"; allCuaSliders.Add(cuaSizeElem); allCuaSlidersUI.Add(tmpSlider); } } JSONStorableFloat cuaSizeAll = new JSONStorableFloat("all_resize", 1f, 0f, 10f){isStorable=false,isRestorable=false}; cuaSizeAll.setCallbackFunction += (val) => { OnChangeCUAAllSizes(val); }; tmpSlider = CreateSlider(cuaSizeAll, true); tmpSlider.valueFormat = "F2"; tmpSlider.label = "Change all CUA Scale"; allCuaSlidersUI.Add(tmpSlider); } private void OnChangeCUASize(Atom at, float val) { at.GetStorableByID("scale").SetFloatParamValue("scale", val); } private void OnChangeCUAAllSizes(float value) { foreach (JSONStorableFloat jsf in allCuaSliders) { jsf.val = value; } } // ************************** // Time to cleanup ! // ************************** void OnDestroy() { } // ************************** // Local Tools // ************************** private void logDebug( string debugText ) { SuperController.LogMessage( debugText ); } private void logError( string debugText ) { SuperController.LogError( debugText ); } public UIDynamicTextField CreateStaticDescriptionText(string DescTitle, string DescText, bool rightSide, int fieldHeight, TextAnchor textAlignment = TextAnchor.UpperLeft, bool disableBackground = true, bool disableScroll = true ) { JSONStorableString staticDescString = new JSONStorableString(DescTitle,DescText) {isStorable=false,isRestorable=false}; staticDescString.hidden = true; UIDynamicTextField staticDescStringField = CreateTextField(staticDescString, rightSide); if( disableBackground ) staticDescStringField.backgroundColor = new Color(1f, 1f, 1f, 0f); staticDescStringField.UItext.alignment = textAlignment; LayoutElement sdsfLayout = staticDescStringField.GetComponent<LayoutElement>(); sdsfLayout.preferredHeight = sdsfLayout.minHeight = fieldHeight; staticDescStringField.height = fieldHeight; if( disableScroll ) DisableScrollOnText(staticDescStringField); return staticDescStringField; } public static void DisableScrollOnText(UIDynamicTextField target) { // THIS is important, it's a "useless" temporary canvas group that will prevent the event from the mousewheel CanvasGroup tmpCG = target.UItext.transform.parent.transform.parent.transform.parent.gameObject.AddComponent<CanvasGroup>(); tmpCG.blocksRaycasts = false; ScrollRect targetSR = target.UItext.transform.parent.transform.parent.transform.parent.GetComponent<ScrollRect>(); if( targetSR != null ) { targetSR.horizontal = false; targetSR.vertical = false; } } } }
ok thanks again i will use this for my sceneNope not really.
If you prefer, the code uses the scale slider. It means it scale the parent of the CUA. If the CUA is made properly ( ie : the root and the placement is placed at 0.0.0, the scale should have no influence on the position. If the asset is randomly placed or like, centered on the Y coordinate, then you will have the origin moving in the scaling process.
On top of that it's a "per object" scaling. It's not scaling like if it's considering the whole scene to be "one object" getting scaled. ( so, correcting position "proportionally" )
It's simply a fast hack I made to ease your life, I wasn't planning on making this a big plugin or delve deeper than that for assets authored in a weird way![]()