Skip to content

Conversation

@hj-cpdm-son
Copy link
Contributor

  • Update the controller asset to the latest version.

Before
image

After
image

Copy link
Collaborator

@salarkhan-google salarkhan-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the goal of updating this asset to try to match the real controller? Because it seems like there is still a notable difference. The new asset has a more grey tint and it very different from the sysui controller model.
some2

@hj-cpdm-son
Copy link
Contributor Author

Hello.
I’ve confirmed the latest controller assets with the UX team and I completed the update.
There are some differences compared to the system, but these have been verified to be due to shading and lighting. The underlying assets are the same across Unity and the system.
Thank you.

Copy link
Collaborator

@salarkhan-google salarkhan-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything is almost good. Just need to update the shader and baseColor texture, and ensure all textures have sRGB set to false. Then the controller looks more like the sysui controller.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can get rid of this since now we have a single texture storing metallic and roughness

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BaseColor is incorrect. Use the texture from sysui.
sysuiBaseColor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the image you attached isn’t the latest. The menu icon is different.
The image below (which I added) is the latest version.
image

float3 arm = tex2D (_AoRoughnessMetallic, IN.uv_BaseColor);
o.Metallic = arm.b;
o.Smoothness = 1 - arm.g;
o.Occlusion = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

o.Occlusion = arm.r;

according to the material in sysui

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@salarkhan-google
Copy link
Collaborator

From your scripts and shader file, please remove all trailing white space. Use space instead of tabs.

Copy link
Collaborator

@salarkhan-google salarkhan-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to ensure you format your code correctly according to C# standards.

SA1600: Public classes and methods must have a document header
US1400: Indentations must use 4 spaces
US1300: Lines must contain 100 characters or fewer. If contains more than 100 characters, split over multiple lines in clang format.
SA1215: All non-static readonly private fields must be placed before all non-static non-readonly private fields.

Please check the scripts in the other samples to understand the formatting.

/// </summary>
public class XRControllerDisplay : MonoBehaviour
{
#pragma warning disable CS0649 // Serialized fields don't need assignment
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either bring back the warning disabler or ensure to assign private fields with some default value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the warning disabler

Comment on lines 177 to 181
[SerializeField] private Transform _targetObject;
[SerializeField] private Vector3 _releasedPosition;
[SerializeField] private Vector3 _pressedPosition;
[SerializeField] private Vector3 _releasedRotation;
[SerializeField] private Vector3 _pressedRotation;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even here consider adding the #pragma warning disable CS0649 // Serialized fields don't need assignment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the warning disabler

Comment on lines 150 to 158
private static void EnableActions(params InputAction[] actions)
{
foreach (var a in actions) a?.Enable();
}

private static void DisableActions(params InputAction[] actions)
{
foreach (var a in actions) a?.Disable();
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't make sense to make these methods static since they are private anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment on lines 54 to 57
private readonly List<(InputAction action,
Action<InputAction.CallbackContext> onStarted,
Action<InputAction.CallbackContext> onPerformed,
Action<InputAction.CallbackContext> onCanceled)> _bindings = new();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readonly members should go above all private members.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment on lines 54 to 57
private readonly List<(InputAction action,
Action<InputAction.CallbackContext> onStarted,
Action<InputAction.CallbackContext> onPerformed,
Action<InputAction.CallbackContext> onCanceled)> _bindings = new();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seperate () and new to make it "new ()"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

}

[Serializable]
public class XrControllerButtonInfo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need public class description header

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the description header.

Comment on lines 183 to 208
public Vector3 GetPositionLerp(float t)
{
return Vector3.Lerp(_releasedPosition, _pressedPosition, t);
}

public Vector3 GetRotationLerp(float t)
{
return Vector3.Lerp(_releasedRotation, _pressedRotation, t);
}

public Quaternion GetRotationQuaternionLerp(float t)
{
return Quaternion.Euler(Vector3.Lerp(_releasedRotation, _pressedRotation, t));
}

public void SetStatus(float t)
{
if (_targetObject == null) return;
t = Mathf.Clamp01(t);

_targetObject.localPosition = Vector3.Lerp(_releasedPosition, _pressedPosition, t);
_targetObject.localRotation = Quaternion.Lerp(
Quaternion.Euler(_releasedRotation),
Quaternion.Euler(_pressedRotation),
t);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need public method description headers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the description header.

Comment on lines 25 to 27
/// <summary>
/// Used to display the controller asset.
/// </summary>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not remove class description headers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the description header.

@hj-cpdm-son
Copy link
Contributor Author

Thanks for the comment. I’ve updated it.

Action<InputAction.CallbackContext> onStarted,
Action<InputAction.CallbackContext> onPerformed,
Action<InputAction.CallbackContext> onCanceled)> _bindings = new ();

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove trailing white space

ENDCG
}
FallBack "Diffuse"
} No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All source files must have a new line at end

ENDCG
}
}
} No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All source files must have new line at end

}
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All source files must have new line at end

Comment on lines 192 to 193
if (_thumbstickTransform != null)
_thumbstickTransform.localRotation = _thumbstickInitialRotation;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add curly brackets to all if statements. if statements without curly brackets are not allowed. Ensure each bracket is on new line. Ensure there is a one line space between ending curly bracket and statements below it.

_triggerAxisAction,
_gripAxisAction,
_thumbstickAxisAction
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing round bracket must be on same line as final statement.

@salarkhan-google
Copy link
Collaborator

@hj-cpdm-son please bring my recent changes on the main branch in your fork main branch. My new changes contains a github action which should then help you identify formatting errors or build related issues.

@salarkhan-google salarkhan-google merged commit c6aa7e9 into android:main Nov 17, 2025
1 check passed
salarkhan-google pushed a commit that referenced this pull request Nov 17, 2025
* Update controller asset

* Update resources to latest

* Update resources(scripts, png)

* Update code format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants