We are working with LR6.0.6 asset publisher. If we configure an asset publisher with a category that doesn't contain any asset, then the asset publisher is hidden if we toggle off from the dockbar.
We would like to show the asset publisher with the default message, as we are not showing the dockbar to the users.
Thanks in advance..
In \html\portlet\asset_publisher\init.jsp file make changes[using liferay-hook] for line
boolean showPortletWithNoResults = false;
And make it
boolean showPortletWithNoResults = true;
This would solve your issue.
By this you would be able to see message "There are no results." .
Related
I need to write a VR application that disables HMD positional tracking for a specific situation and then reenable it again.
In the UI it is a simple as ticking and unticking the TrackedPoseDriver shown in the picture below.
How can I do that via Scripting?
I assume I need to use the enabled property of a game object. But I don't know how to grab a hold of this GameObject (or Component).
EDIT: In case this was clear this is GameObject/Component associated to the main camera.
Ok. So I was able to do It.
What I did is I search MonoBehaviour Based Components on the camera and then cast it to a MonoBehaviour once I found the right one. And then used the enabled property. Like this:
Component[] components = Camera.main.GetComponents(typeof(MonoBehaviour));
bool found = false;
foreach(Component component in components) {
string name = component.ToString();
MonoBehaviour mb = (MonoBehaviour) component;
if (name.Contains(TRACK_POSE_DRIVER_NAME)){
mbTrackingPose = mb;
found = true;
break;
}
}
The unique string that the toString() method provided was somethign like (I don't have it on hand) "Main Camera (Unity.XR.TrackedPoseDriver)". So I just made sure that the string had the "TrackedPoseDriver" and stored that as a MonoBehaviour.
I hope this helps someone else.
Unity ver. 2019.4.19
Sorry for editing this question several time, I didn't use the term editor and edit mode correctly and I worte the code wrong. Now I've fixed.
I'm using timeline in my project. I made a custom clip like this to change some properties in matrial.
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
{
GameObject target = GetTargetGameObject();
var renderers = target.GetComponentsInChildren<Renderer>();
foreach (var r in renderers)
{
if (!Application.isPlaying)
{
foreach (var mat in r.sharedMaterials)
{
mat.SetFloat("_SomeProperty", SomeValueChangedByPlaytime(data));
}
}
else
{
// in play mode use r.materials instead
}
}
}
I want to check the effects in timeline while I'm in edit mode, but I don't want to change my material assets by my code.
If I Use
r.sharedMaterials
This will change all matrial assets and this may cause some unexpected effect on unintended objects.
If I Use
r.materials
This will cause error "Instantiating material due to calling renderer.material during edit mode"
So how can I avoid changing matrial asset while still get correct preview in timeline edit mode?
I have a Scene marked as Addressable. Given the Scene itself, is it possible to get the AssetReference for that scene?
For example, in the following code snippet, what would ?? need to be?
Scene activeScene = SceneManager.GetActiveScene();
// What can I call here to get the AssetReference?
AssetReference activeSceneReference = ??;
If this is possible at all I honetsly can't tell since I never worked with Addressables so far.
However, following the APIs this might be possible but requires multiple steps:
Since the activeScene is a loaded scene and the same scene can be loaded multiple times via additive loading it is not actually an asset anymore and therefore doesn't have an asset reference at all.
So the first step is actually
Get the asset for a loaded scene
Having your loaded scene you can still get its original asset path via Scene.path.
var activeScene = SceneManager.GetActiveScene();
var activeScenePath = activeScene.path;
And then use AssetDatabase.LoadAssetAtPath to load the original asset
var activeSceneAsset = AssetDataBase.LoadAssetAtPath<Scene>(activeScenePath);
Now that we have the actual asset of the loaded scene we can
Get the GUID of an Asset
Having already the asset activeSceneAsset you can use AssetDatabase.TryGetGUIDAndLocalFileIdentifier in order to optain the GUID we need in the last step:
if (AssetDatabase.TryGetGUIDAndLocalFileIdentifier(activeSceneAsset, out var guid, out var file))
{
// TODO see below
}
and now having that guid we can use it in order to
Get the AssetReference via the GUID
The reason why we wanted to get the GUID is because we can now use it for the AssetReference constructor taking the GUID as parameter:
var activeSceneReference = new AssetReference(guid);
NOTE: All this is ofcourse only possible in the Unity Editor itself since AssetDataBase does not exist outside of it.
I have the following static camera:
public Camera standbyCamera;
standbyCamera = GameObject.Find("StandByCamera").GetComponent<Camera>();
How can I disable or destroy the associated Audio Listener via code?
I've tried the following, as well as some variants, and nothing works.
How can I disable the Audio Listener associated with a camera?
From the Unity forums:
standbyCamera.GetComponent (AudioListener).enabled = false;
error CS0117: 'UnityEngine.Component' does not contain a definition for 'enabled'
Destroy (standbyCamera.GetComponent (AudioListener));
119: Expression denotes a type', where avariable', value' ormethod group' was expected
You will instead want to do:
Destroy(standbyCamera.GetComponent<AudioListener>());
It looks like you might be able to pause as well.
Or if that is not enough you could try making a child object with the audiolistener and enable/disable that child.
I'm writing a messaging application in GWT, and have a fairly difficult problem to find a solution for. I'm working with a GWT CellList. In my cell list I'm displaying all the recent contacts a user has had recent communication with. But lets say that a user is writing a message to a person not on that list. I temporarily add them to the recentContacts list, and update the CellList so that it shows..
But then let's say that they end up not sending the message. I need to be able to detect that, and remove them from the list. The obvious place to do that is in the selection change handler. It actually turns out though that within a selection change handler, if can modify the list of data objects that represent the cell list, but when you actually push them to the cell list, I get an index out of bounds error.
I've verified that this is the issue. So basically I'm stuck. The obvious place to check this is when your selecting a different contact to view. I can then check if any messages were sent to this other contact, and if not, get rid of the contact, but I need to somehow not do it in the selectionChangeHandler. Does anyone have any solution/ideas? I tried a mouse up event, but that ends up happening before the selection event takes place.
Thanks for any help in advance :-)
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
public void onSelectionChange(SelectionChangeEvent event) {
ContactDO selectedContact = selectionModel.getSelectedObject();
//Check if we want to remove a contact from the list
if ( we want to remove a contact in the list that is not the currently selected contact. ) {
//remove contact
recentContacts.remove(contactThatisNotSelected);
//Refresh the contact cell list
contactCellList.setVisibleRange(0, recentContacts.size());
contactCellList.setRowCount(recentContacts.size(), true);
contactCellList.setRowData(0, recentContacts);
}
}
});
The solution that I implemented was just to use a Timer, and then do the work about 100ms later. Not really a fan of this solution. I'm still looking for another.