Unclaimed Package Is this your package? Claim it to unlock full analytics and manage your listing.
Claim This Package

Install via UPM

Add to Unity Package Manager using this URL

https://www.pkglnk.dev/inspector-only-fields.git?path=InspectorOnlyFields/Packages/InspectorOnlyFields

README Markdown

Copy this to your project's README.md

Style
Preview
pkglnk installs badge
## Installation

Add **InspectorOnlyFields** to your Unity project via Package Manager:

1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/inspector-only-fields.git?path=InspectorOnlyFields%2FPackages%2FInspectorOnlyFields
```

[![pkglnk](https://www.pkglnk.dev/badge/inspector-only-fields.svg?style=pkglnk)](https://www.pkglnk.dev/pkg/inspector-only-fields)

README

InspectorOnlyFields

openupm CI

English / Japanese

This package provides an analyzer that warns against assigning on C# code to fields that are assigned from within the Unity inspector.

Installation

You can install this package using UPM (Unity Package Manager).

Use Git URL

  1. Open Package Manager Window
  2. Click Add(+) on the status bar
  3. Select Add package from git URL
  4. Input https://github.com/miyaji255/InspectorOnlyFields.git?path=InspectorOnlyFields/Packages/InspectorOnlyFields
  5. Click Add

Use OpenUPM

You can install using OpenUPM. The page is here. https://openupm.com/packages/com.github.miyaji255.inspector-only-fields/

Usage

Add the InspectorOnly attribute to fields to which you want to assign values from the inspector. Then, The analyzer will warn you when assigning a value to the fields.

using InspectorOnlyFields;
using UnityEngine;

public class SampleObject : MonoBehaviour
{
    
    // InspOnly001: The assignment to 'GameObject' is prohibited by the InspectorOnly attribute
    [InspectorOnly]
    public GameObject GameObject = new GameObject();

    void Start()
    {
        // InspOnly: The assignment to 'GameObject' is prohibited by the InspectorOnly attribute
        GameObject = new GameObject();
    }
}

Translated by DeepL.com

Comments

No comments yet. Be the first!